problem_id
stringlengths 6
6
| language
stringclasses 2
values | original_status
stringclasses 3
values | original_src
stringlengths 19
243k
| changed_src
stringlengths 19
243k
| change
stringclasses 3
values | i1
int64 0
8.44k
| i2
int64 0
8.44k
| j1
int64 0
8.44k
| j2
int64 0
8.44k
| error
stringclasses 270
values | stderr
stringlengths 0
226k
|
---|---|---|---|---|---|---|---|---|---|---|---|
p02381
|
Python
|
Runtime Error
|
# -*- coding: utf-8 -*-
import math
while True:
n = int(input())
if n == 0:
break
s = list(map(float, input().split()))
mean = sum(s) / len(s)
for i in range(len(s)):
s[i] = (s[i] - sum) * (s[i] - sum)
variance = sum(s) / len(s)
stdev = math.sqrt(variance)
print(stdev)
|
# -*- coding: utf-8 -*-
import math
while True:
n = int(input())
if n == 0:
break
s = list(map(float, input().split()))
mean = sum(s) / len(s)
for i in range(len(s)):
s[i] = (s[i] - mean) * (s[i] - mean)
variance = sum(s) / len(s)
stdev = math.sqrt(variance)
print(stdev)
|
replace
| 14 | 15 | 14 | 15 |
TypeError: unsupported operand type(s) for -: 'float' and 'builtin_function_or_method'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02381/Python/s289178962.py", line 15, in <module>
s[i] = (s[i] - sum) * (s[i] - sum)
TypeError: unsupported operand type(s) for -: 'float' and 'builtin_function_or_method'
|
p02381
|
C++
|
Runtime Error
|
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;
int main() {
int q = 0;
while (1) {
double n;
double date[100];
double sum = 0;
double var = 0;
string haki;
cin >> n;
getline(cin, haki);
if (n == 0)
break;
for (int i = 0; i < n; i++) {
cin >> date[i];
sum += date[i];
}
double ave = sum / n;
for (int i = 0; i < n; i++) {
var += pow(date[i] - ave, 2);
}
cout << fixed << pow(var / n, 0.5) << endl;
q++;
if (q > 10)
break;
}
return 0;
}
|
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;
int main() {
int q = 0;
while (1) {
double n;
double date[1000];
double sum = 0;
double var = 0;
string haki;
cin >> n;
getline(cin, haki);
if (n == 0)
break;
for (int i = 0; i < n; i++) {
cin >> date[i];
sum += date[i];
}
double ave = sum / n;
for (int i = 0; i < n; i++) {
var += pow(date[i] - ave, 2);
}
cout << fixed << pow(var / n, 0.5) << endl;
q++;
if (q > 10)
break;
}
return 0;
}
|
replace
| 10 | 11 | 10 | 11 |
0
| |
p02381
|
C++
|
Runtime Error
|
#include <iomanip>
#include <iostream>
#include <math.h>
using namespace std;
int main() {
int n;
double a[101], s, e;
do {
cin >> n;
if (n == 0)
break;
s = 0;
e = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
s += (a[i] / n);
}
for (int i = 0; i < n; i++) {
e += ((a[i] - s) * (a[i] - s)) / n;
}
cout << fixed;
cout << setprecision(8) << sqrt(e) << endl;
} while (true);
return 0;
}
|
#include <iomanip>
#include <iostream>
#include <math.h>
using namespace std;
int main() {
int n;
double a[1001], s, e;
do {
cin >> n;
if (n == 0)
break;
s = 0;
e = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
s += (a[i] / n);
}
for (int i = 0; i < n; i++) {
e += ((a[i] - s) * (a[i] - s)) / n;
}
cout << fixed;
cout << setprecision(8) << sqrt(e) << endl;
} while (true);
return 0;
}
|
replace
| 6 | 7 | 6 | 7 |
0
| |
p02381
|
C++
|
Runtime Error
|
#include <bits/stdc++.h>
using namespace std;
int main() {
cout << fixed << setprecision(12);
int n;
int s[100];
double sum, ans;
while (1) {
cin >> n;
if (n == 0)
break;
sum = 0;
ans = 0;
for (int i = 0; i < n; i++) {
cin >> s[i];
sum += s[i];
}
sum /= n;
for (int i = 0; i < n; i++) {
ans += pow(sum - s[i], 2);
}
ans = sqrt(ans / n);
cout << ans << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
cout << fixed << setprecision(12);
int n;
int s[1000];
double sum, ans;
while (1) {
cin >> n;
if (n == 0)
break;
sum = 0;
ans = 0;
for (int i = 0; i < n; i++) {
cin >> s[i];
sum += s[i];
}
sum /= n;
for (int i = 0; i < n; i++) {
ans += pow(sum - s[i], 2);
}
ans = sqrt(ans / n);
cout << ans << endl;
}
return 0;
}
|
replace
| 5 | 6 | 5 | 6 |
0
| |
p02381
|
C++
|
Runtime Error
|
#include <cmath>
#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
double point, a, n, s[100], m; // a標準偏差 n学生の数
while (1) {
m = 0;
point = 0;
cin >> n;
if (n == 0)
break;
a = 0;
for (int i = 0; i < n; i++) {
cin >> s[i];
point += s[i];
}
m = point / n;
for (int i = 0; i < n; i++) {
a += pow(s[i] - m, 2);
}
a = sqrt(a / n);
printf("%f\n", a);
}
return 0;
}
|
#include <cmath>
#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
double point, a, n, s[1000], m; // a標準偏差 n学生の数
while (1) {
m = 0;
point = 0;
cin >> n;
if (n == 0)
break;
a = 0;
for (int i = 0; i < n; i++) {
cin >> s[i];
point += s[i];
}
m = point / n;
for (int i = 0; i < n; i++) {
a += pow(s[i] - m, 2);
}
a = sqrt(a / n);
printf("%f\n", a);
}
return 0;
}
|
replace
| 5 | 6 | 5 | 6 |
0
| |
p02381
|
C++
|
Runtime Error
|
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <sstream>
using namespace std;
#define MPI 3.14159265358979323846
int main() {
while (true) {
int n, s[101], sum = 0;
double a = 0, m;
cin >> n;
if (n == 0)
break;
for (int i = 0; i < n; i++) {
cin >> s[i];
sum += s[i];
}
m = (double)sum / (double)n;
for (int i = 0; i < n; i++) {
a += pow(s[i] - m, 2) / (double)n;
}
printf("%.8f\n", sqrt(a));
}
return 0;
}
|
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <sstream>
using namespace std;
#define MPI 3.14159265358979323846
int main() {
while (true) {
int n, s[1001], sum = 0;
double a = 0, m;
cin >> n;
if (n == 0)
break;
for (int i = 0; i < n; i++) {
cin >> s[i];
sum += s[i];
}
m = (double)sum / (double)n;
for (int i = 0; i < n; i++) {
a += pow(s[i] - m, 2) / (double)n;
}
printf("%.8f\n", sqrt(a));
}
return 0;
}
|
replace
| 11 | 12 | 11 | 12 |
0
| |
p02381
|
C++
|
Runtime Error
|
#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
int n, s[100];
while (1) {
double a = 0;
cin >> n;
if (n == 0)
break;
for (int i = 0; i < n; i++) {
cin >> s[i];
a += s[i];
}
double b = a / n;
double c = 0;
for (int i = 0; i < n; i++) {
c += pow(b - s[i], 2.0);
}
double d = 0;
d = sqrt(c / n);
printf("%.8f\n", d);
}
return 0;
}
|
#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
int n, s[1001];
while (1) {
double a = 0;
cin >> n;
if (n == 0)
break;
for (int i = 0; i < n; i++) {
cin >> s[i];
a += s[i];
}
double b = a / n;
double c = 0;
for (int i = 0; i < n; i++) {
c += pow(b - s[i], 2.0);
}
double d = 0;
d = sqrt(c / n);
printf("%.8f\n", d);
}
return 0;
}
|
replace
| 5 | 6 | 5 | 6 |
0
| |
p02381
|
C++
|
Runtime Error
|
#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
int n;
double s[101], sum, dist, m;
while (1) {
cin >> n;
sum = 0.0;
dist = 0.0;
if (n == 0)
break;
for (int i = 0; i < n; i++) {
cin >> s[i];
sum += s[i];
}
m = sum / n;
for (int i = 0; i < n; i++) {
dist += pow(s[i] - m, 2);
}
printf("%lf\n", sqrt(dist / n));
}
return 0;
}
|
#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
int n;
double s[1000], sum, dist, m;
while (1) {
cin >> n;
sum = 0.0;
dist = 0.0;
if (n == 0)
break;
for (int i = 0; i < n; i++) {
cin >> s[i];
sum += s[i];
}
m = sum / n;
for (int i = 0; i < n; i++) {
dist += pow(s[i] - m, 2);
}
printf("%lf\n", sqrt(dist / n));
}
return 0;
}
|
replace
| 7 | 8 | 7 | 8 |
0
| |
p02381
|
C++
|
Time Limit Exceeded
|
#include <cmath>
#include <iostream>
using namespace std;
int main() {
int time;
double m;
int s[100];
double apow;
while (true) {
cin >> time;
if (time == 0)
break;
apow = 0;
m = 0;
for (int i = 0; i < time; ++i) {
cin >> s[i];
m += s[i];
}
m /= (double)time;
for (int i = 0; i < time; ++i) {
apow += pow((double)s[i] - m, 2.0);
}
cout << sqrt(apow / (double)time) << endl;
}
return 0;
}
|
#include <cmath>
#include <iostream>
using namespace std;
int main() {
int time;
double m;
int s[1000];
double apow;
while (true) {
cin >> time;
if (time == 0)
break;
apow = 0;
m = 0;
for (int i = 0; i < time; ++i) {
cin >> s[i];
m += s[i];
}
m /= (double)time;
for (int i = 0; i < time; ++i) {
apow += pow((double)s[i] - m, 2.0);
}
cout << sqrt(apow / (double)time) << endl;
}
return 0;
}
|
replace
| 6 | 7 | 6 | 7 |
TLE
| |
p02381
|
C++
|
Runtime Error
|
#include <iomanip>
#include <iostream>
#include <math.h>
#define PI 3.14159265
double standard_deviation(double *s, double m, double n) {
double sum_ = 0;
for (int i = 0; i < n; i++) {
sum_ += pow((s[i] - m), 2);
}
return sum_ / n;
}
int main() {
double n;
double s[100] = {0};
double m = 0;
while (true) {
m = 0;
std::cin >> n;
if (n == 0)
break;
for (int i = 0; i < n; i++) {
std::cin >> s[i];
m += s[i];
}
m /= n;
std::cout << std::fixed << std::setprecision(8)
<< sqrt(standard_deviation(s, m, n)) << std::endl;
}
return 0;
}
|
#include <iomanip>
#include <iostream>
#include <math.h>
#define PI 3.14159265
double standard_deviation(double *s, double m, double n) {
double sum_ = 0;
for (int i = 0; i < n; i++) {
sum_ += pow((s[i] - m), 2);
}
return sum_ / n;
}
int main() {
double n;
double s[1000] = {0};
double m = 0;
while (true) {
m = 0;
std::cin >> n;
if (n == 0)
break;
for (int i = 0; i < n; i++) {
std::cin >> s[i];
m += s[i];
}
m /= n;
std::cout << std::fixed << std::setprecision(8)
<< sqrt(standard_deviation(s, m, n)) << std::endl;
}
return 0;
}
|
replace
| 16 | 17 | 16 | 17 |
0
| |
p02381
|
C++
|
Time Limit Exceeded
|
#include <iostream>
#include <math.h>
#define REP(i, a, b) for (i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
int main() {
int n, s[100], i;
double m, d;
cout.precision(8);
while (1) {
cin >> n;
if (n == 0)
break;
m = 0;
d = 0;
rep(i, n) {
cin >> s[i];
m += s[i];
}
m = m / n;
rep(i, n) d += pow(s[i] - m, 2.0);
d = sqrt(d / n);
cout << fixed << d << endl;
}
return 0;
}
|
#include <iostream>
#include <math.h>
#define REP(i, a, b) for (i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
int main() {
int n, s[1000], i;
double m, d;
cout.precision(8);
while (1) {
cin >> n;
if (n == 0)
break;
m = 0;
d = 0;
rep(i, n) {
cin >> s[i];
m += s[i];
}
m = m / n;
rep(i, n) d += pow(s[i] - m, 2.0);
d = sqrt(d / n);
cout << fixed << d << endl;
}
return 0;
}
|
replace
| 9 | 10 | 9 | 10 |
TLE
| |
p02381
|
C++
|
Time Limit Exceeded
|
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
using namespace std;
int main() {
int n;
int S[100];
double sum = 0;
double std = 0;
double deviate = 0;
while (1) {
cin >> n;
if (n == 0)
break;
for (int i = 0; i < n; i++)
cin >> S[i];
for (int i = 0; i < n; i++) {
sum += S[i];
}
for (int i = 0; i < n; i++) {
deviate += (S[i] - sum / n) * (S[i] - sum / n);
}
printf("%lf\n", sqrt(deviate / n));
sum = 0;
std = 0;
deviate = 0;
}
return 0;
}
|
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
using namespace std;
int main() {
int n;
int S[1000];
double sum = 0;
double std = 0;
double deviate = 0;
while (1) {
cin >> n;
if (n == 0)
break;
for (int i = 0; i < n; i++)
cin >> S[i];
for (int i = 0; i < n; i++) {
sum += S[i];
}
for (int i = 0; i < n; i++) {
deviate += (S[i] - sum / n) * (S[i] - sum / n);
}
printf("%lf\n", sqrt(deviate / n));
sum = 0;
std = 0;
deviate = 0;
}
return 0;
}
|
replace
| 10 | 11 | 10 | 11 |
TLE
| |
p02381
|
C++
|
Runtime Error
|
// class point の練習(クラスの高度な実装)
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <vector>
typedef long long llong;
using namespace std;
int main() {
int n;
int score[150];
double mean, var;
while (1) {
scanf("%d", &n);
if (!n)
break;
mean = 0;
var = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &score[i]);
mean += (double)score[i];
}
mean /= n;
for (int i = 0; i < n; i++) {
var += ((double)score[i] - mean) * ((double)score[i] - mean);
}
var /= n;
cout << fixed << setprecision(10) << sqrt(var) << endl;
}
return 0;
}
|
// class point の練習(クラスの高度な実装)
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <vector>
typedef long long llong;
using namespace std;
int main() {
int n;
int score[1100];
double mean, var;
while (1) {
scanf("%d", &n);
if (!n)
break;
mean = 0;
var = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &score[i]);
mean += (double)score[i];
}
mean /= n;
for (int i = 0; i < n; i++) {
var += ((double)score[i] - mean) * ((double)score[i] - mean);
}
var /= n;
cout << fixed << setprecision(10) << sqrt(var) << endl;
}
return 0;
}
|
replace
| 14 | 15 | 14 | 15 |
0
| |
p02381
|
C++
|
Runtime Error
|
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iostream>
#include <list>
#include <queue>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265358979
using namespace std;
typedef pair<int, int> P;
int main(void) {
int n;
while (cin >> n, n) {
int s[101];
double alpha = 0, ave = 0;
FOR(i, 1, n) {
cin >> s[i];
ave += s[i];
}
ave /= n;
FOR(i, 1, n) { alpha += (s[i] - ave) * (s[i] - ave); }
alpha /= n;
alpha = sqrt(alpha);
printf("%.10lf\n", alpha);
}
return 0;
}
|
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iostream>
#include <list>
#include <queue>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265358979
using namespace std;
typedef pair<int, int> P;
int main(void) {
int n;
while (cin >> n, n) {
int s[1001];
double alpha = 0, ave = 0;
FOR(i, 1, n) {
cin >> s[i];
ave += s[i];
}
ave /= n;
FOR(i, 1, n) { alpha += (s[i] - ave) * (s[i] - ave); }
alpha /= n;
alpha = sqrt(alpha);
printf("%.10lf\n", alpha);
}
return 0;
}
|
replace
| 26 | 27 | 26 | 27 |
0
| |
p02381
|
C++
|
Runtime Error
|
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <time.h>
#include <valarray>
#include <vector>
using namespace std;
int main(void) {
long double s[500], Hei, kari;
long int n;
for (long int A = 0; A < 1000; A++) {
cin >> n;
if (n == 0) {
break;
}
for (long int i = 0; i < n; i++) {
cin >> s[i];
Hei += s[i];
}
for (long int i = 0; i < n; i++) {
kari += (s[i] - Hei / n) * (s[i] - Hei / n);
}
cout << fixed << setprecision(8) << sqrt(kari / n) << endl;
Hei = 0;
kari = 0;
}
}
|
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <time.h>
#include <valarray>
#include <vector>
using namespace std;
int main(void) {
long double s[1000], Hei, kari;
long int n;
for (long int A = 0; A < 1000; A++) {
cin >> n;
if (n == 0) {
break;
}
for (long int i = 0; i < n; i++) {
cin >> s[i];
Hei += s[i];
}
for (long int i = 0; i < n; i++) {
kari += (s[i] - Hei / n) * (s[i] - Hei / n);
}
cout << fixed << setprecision(8) << sqrt(kari / n) << endl;
Hei = 0;
kari = 0;
}
}
|
replace
| 16 | 17 | 16 | 17 |
0
| |
p02381
|
C++
|
Runtime Error
|
#include <algorithm>
#include <cctype>
#include <math.h>
#include <stdio.h>
#include <string.h>
#define PI 3.1415926
int main() {
int n, s[101];
double sum = 0;
double a2 = 0;
while (1) {
scanf("%d", &n);
if (n == 0) {
break;
}
for (int i = 1; i <= n; i++) {
scanf("%d", &s[i]);
sum += s[i];
}
sum /= n;
for (int i = 1; i <= n; i++) {
a2 += (s[i] - sum) * (s[i] - sum);
}
printf("%f\n", sqrt(a2 / n));
sum = 0;
a2 = 0;
}
return 0;
}
|
#include <algorithm>
#include <cctype>
#include <math.h>
#include <stdio.h>
#include <string.h>
#define PI 3.1415926
int main() {
int n, s[2000];
double sum = 0;
double a2 = 0;
while (1) {
scanf("%d", &n);
if (n == 0) {
break;
}
for (int i = 1; i <= n; i++) {
scanf("%d", &s[i]);
sum += s[i];
}
sum /= n;
for (int i = 1; i <= n; i++) {
a2 += (s[i] - sum) * (s[i] - sum);
}
printf("%f\n", sqrt(a2 / n));
sum = 0;
a2 = 0;
}
return 0;
}
|
replace
| 9 | 10 | 9 | 10 |
0
| |
p02381
|
C++
|
Runtime Error
|
#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
// int n,vol,s[100];
double a, n, vol, s[100], avg;
while (true) {
cin >> n;
if (n == 0)
break;
vol = 0;
a = 0;
for (int i = 0; i < n; i++) {
cin >> s[i];
vol += s[i];
}
avg = vol / n;
for (int i = 0; i < n; i++) {
a += pow(s[i] - avg, 2.0);
}
a /= n;
printf("%lf\n", sqrt(a));
}
return 0;
}
|
#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
// int n,vol,s[100];
double a, n, vol, s[1000], avg;
while (true) {
cin >> n;
if (n == 0)
break;
vol = 0;
a = 0;
for (int i = 0; i < n; i++) {
cin >> s[i];
vol += s[i];
}
avg = vol / n;
for (int i = 0; i < n; i++) {
a += pow(s[i] - avg, 2.0);
}
a /= n;
printf("%lf\n", sqrt(a));
}
return 0;
}
|
replace
| 7 | 8 | 7 | 8 |
0
| |
p02381
|
C++
|
Time Limit Exceeded
|
#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
while (1) {
int n;
cin >> n;
if (n == 0) {
break;
}
int s[101];
double total = 0;
for (int i = 0; i < n; i++) {
cin >> s[i];
total += s[i];
}
double m = total / n;
double a_2 = 0;
for (int i = 0; i < n; i++) {
a_2 += (s[i] - m) * (s[i] - m) / n;
}
double a = sqrt(a_2);
printf("%.4f\n", a);
}
return 0;
}
|
#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
while (1) {
int n;
cin >> n;
if (n == 0) {
break;
}
int s[1000];
double total = 0;
for (int i = 0; i < n; i++) {
cin >> s[i];
total += s[i];
}
double m = total / n;
double a_2 = 0;
for (int i = 0; i < n; i++) {
a_2 += (s[i] - m) * (s[i] - m) / n;
}
double a = sqrt(a_2);
printf("%.4f\n", a);
}
return 0;
}
|
replace
| 14 | 15 | 14 | 15 |
TLE
| |
p02381
|
C++
|
Runtime Error
|
#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
int n;
const int max_n = 100;
double a[max_n];
while (cin >> n, n) {
double s = 0.0;
double sum = 0.0;
for (int i = 0; i < n; i++) {
cin >> a[i];
sum += a[i];
}
double m = sum / n;
for (int i = 0; i < n; i++) {
s += pow(a[i] - m, 2);
}
s /= n;
s = sqrt(s);
printf("%.6f\n", s);
}
return 0;
}
|
#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
int n;
const int max_n = 1000;
double a[max_n];
while (cin >> n, n) {
double s = 0.0;
double sum = 0.0;
for (int i = 0; i < n; i++) {
cin >> a[i];
sum += a[i];
}
double m = sum / n;
for (int i = 0; i < n; i++) {
s += pow(a[i] - m, 2);
}
s /= n;
s = sqrt(s);
printf("%.6f\n", s);
}
return 0;
}
|
replace
| 7 | 8 | 7 | 8 |
0
| |
p02381
|
C++
|
Runtime Error
|
#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
while (1) {
long long n, sum = 0, s[101];
double sum2 = 0;
cin >> n;
if (n == 0)
break;
for (int i = 1; i <= n; i++) {
cin >> s[i];
sum += s[i];
}
double m = (double)sum / n;
for (int i = 1; i <= n; i++) {
sum2 += (s[i] - m) * (s[i] - m);
}
double a2 = (double)sum2 / n;
printf("%lf\n", sqrt(a2));
}
return 0;
}
|
#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
while (1) {
long long n, sum = 0, s[1001];
double sum2 = 0;
cin >> n;
if (n == 0)
break;
for (int i = 1; i <= n; i++) {
cin >> s[i];
sum += s[i];
}
double m = (double)sum / n;
for (int i = 1; i <= n; i++) {
sum2 += (s[i] - m) * (s[i] - m);
}
double a2 = (double)sum2 / n;
printf("%lf\n", sqrt(a2));
}
return 0;
}
|
replace
| 7 | 8 | 7 | 8 |
0
| |
p02381
|
C++
|
Runtime Error
|
#include <iomanip>
#include <iostream>
#include <math.h>
using namespace std;
int main() {
double n, a[100], sum, sig;
while (1) {
sum = 0;
sig = 0;
cin >> n;
if (n == 0)
break;
for (int i = 0; i < n; i++) {
cin >> a[i];
sum += a[i];
}
for (int i = 0; i < n; i++) {
sig += pow(a[i] - sum / n, 2);
}
cout << fixed << setprecision(6) << sqrt(sig / n) << endl;
}
return 0;
}
|
#include <iomanip>
#include <iostream>
#include <math.h>
using namespace std;
int main() {
double n, a[1000], sum, sig;
while (1) {
sum = 0;
sig = 0;
cin >> n;
if (n == 0)
break;
for (int i = 0; i < n; i++) {
cin >> a[i];
sum += a[i];
}
for (int i = 0; i < n; i++) {
sig += pow(a[i] - sum / n, 2);
}
cout << fixed << setprecision(6) << sqrt(sig / n) << endl;
}
return 0;
}
|
replace
| 7 | 8 | 7 | 8 |
0
| |
p02382
|
C++
|
Runtime Error
|
#include <cmath>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> x(3, 0), y(3, 0);
for (int i = 0; i < n; ++i)
cin >> x[i];
for (int i = 0; i < n; ++i)
cin >> y[i];
// ???????????????????????¢(p = 1)
double md = 0.0;
double p = 1.0;
for (int i = 0; i < n; ++i)
md += pow(abs(x[i] - y[i]), p);
md = pow(md, 1 / p);
// ???????????????????????¢(p = 2)
double ed = 0.0;
p = 2.0;
for (int i = 0; i < n; ++i)
ed += pow(abs(x[i] - y[i]), p);
ed = pow(ed, 1 / p);
// p = 3?????¨???
double td = 0.0;
p = 3.0;
for (int i = 0; i < n; ++i)
td += pow(abs(x[i] - y[i]), p);
td = pow(td, 1 / p);
// ?????§????????§????????¢(p = ???)
double cd = 0.0;
for (int i = 0; i < n; ++i)
if (abs(x[i] - y[i]) > cd)
cd = abs(x[i] - y[i]);
cout << setprecision(16) << md << endl;
cout << ed << endl;
cout << td << endl;
cout << cd << endl;
return 0;
}
|
#include <cmath>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> x(n, 0), y(n, 0);
for (int i = 0; i < n; ++i)
cin >> x[i];
for (int i = 0; i < n; ++i)
cin >> y[i];
// ???????????????????????¢(p = 1)
double md = 0.0;
double p = 1.0;
for (int i = 0; i < n; ++i)
md += pow(abs(x[i] - y[i]), p);
md = pow(md, 1 / p);
// ???????????????????????¢(p = 2)
double ed = 0.0;
p = 2.0;
for (int i = 0; i < n; ++i)
ed += pow(abs(x[i] - y[i]), p);
ed = pow(ed, 1 / p);
// p = 3?????¨???
double td = 0.0;
p = 3.0;
for (int i = 0; i < n; ++i)
td += pow(abs(x[i] - y[i]), p);
td = pow(td, 1 / p);
// ?????§????????§????????¢(p = ???)
double cd = 0.0;
for (int i = 0; i < n; ++i)
if (abs(x[i] - y[i]) > cd)
cd = abs(x[i] - y[i]);
cout << setprecision(16) << md << endl;
cout << ed << endl;
cout << td << endl;
cout << cd << endl;
return 0;
}
|
replace
| 11 | 12 | 11 | 12 |
0
| |
p02382
|
C++
|
Time Limit Exceeded
|
#include <bits/stdc++.h>
using namespace std;
int n;
double x[100], y[100];
double distance(double p) {
double sum = 0;
for (int i = 0; i < n; i++) {
double w = abs(x[i] - y[i]);
sum += pow(w, p);
}
return pow(sum, 1.0 / p);
}
int main() {
cout << fixed << setprecision(12);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x[i];
}
for (int i = 0; i < n; i++) {
cin >> y[i];
}
cout << distance(1) << endl;
cout << distance(2) << endl;
cout << distance(3) << endl;
double mx = 0;
for (int i = 0; i, n; i++) {
mx = max(mx, abs(x[i] - y[i]));
}
cout << mx << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
double x[100], y[100];
double distance(double p) {
double sum = 0;
for (int i = 0; i < n; i++) {
double w = abs(x[i] - y[i]);
sum += pow(w, p);
}
return pow(sum, 1.0 / p);
}
int main() {
cout << fixed << setprecision(12);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x[i];
}
for (int i = 0; i < n; i++) {
cin >> y[i];
}
cout << distance(1) << endl;
cout << distance(2) << endl;
cout << distance(3) << endl;
double mx = 0;
for (int i = 0; i < n; i++) {
mx = max(mx, abs(x[i] - y[i]));
}
cout << mx << endl;
return 0;
}
|
replace
| 28 | 29 | 28 | 29 |
TLE
| |
p02383
|
C++
|
Time Limit Exceeded
|
#include <iostream>
#include <string>
using namespace std;
enum eRoll { W, S, N, E };
class Dice {
private:
int _dice[6];
public:
void roll(eRoll er) {
int _diceinfo[6];
for (int i = 0; i < 6; ++i) {
_diceinfo[i] = _dice[i];
}
switch (er) {
case W:
_dice[0] = _diceinfo[2];
_dice[1] = _diceinfo[1];
_dice[2] = _diceinfo[5];
_dice[3] = _diceinfo[0];
_dice[4] = _diceinfo[4];
_dice[5] = _diceinfo[3];
break;
case S:
_dice[0] = _diceinfo[4];
_dice[1] = _diceinfo[0];
_dice[2] = _diceinfo[2];
_dice[3] = _diceinfo[3];
_dice[4] = _diceinfo[5];
_dice[5] = _diceinfo[1];
break;
case N:
_dice[0] = _diceinfo[1];
_dice[1] = _diceinfo[5];
_dice[2] = _diceinfo[2];
_dice[3] = _diceinfo[3];
_dice[4] = _diceinfo[0];
_dice[5] = _diceinfo[4];
break;
case E:
_dice[0] = _diceinfo[3];
_dice[1] = _diceinfo[1];
_dice[2] = _diceinfo[0];
_dice[3] = _diceinfo[5];
_dice[4] = _diceinfo[4];
_dice[5] = _diceinfo[2];
break;
}
}
int getTopNum() { return _dice[0]; }
void setNum() {
for (int i = 0; i < 6; ++i) {
cin >> _dice[i];
}
}
};
int main() {
Dice dice;
dice.setNum();
string s;
cin >> s;
for (int i = 0; i < s.size(); ++i) {
if (s[i] == 'S') {
dice.roll(eRoll::S);
} else if (s[i] == 'W') {
dice.roll(eRoll::W);
} else if (s[i] == 'E') {
dice.roll(eRoll::E);
} else if (s[i] == 'N') {
dice.roll(eRoll::N);
}
}
cout << dice.getTopNum() << endl;
while (true)
;
return 0;
}
|
#include <iostream>
#include <string>
using namespace std;
enum eRoll { W, S, N, E };
class Dice {
private:
int _dice[6];
public:
void roll(eRoll er) {
int _diceinfo[6];
for (int i = 0; i < 6; ++i) {
_diceinfo[i] = _dice[i];
}
switch (er) {
case W:
_dice[0] = _diceinfo[2];
_dice[1] = _diceinfo[1];
_dice[2] = _diceinfo[5];
_dice[3] = _diceinfo[0];
_dice[4] = _diceinfo[4];
_dice[5] = _diceinfo[3];
break;
case S:
_dice[0] = _diceinfo[4];
_dice[1] = _diceinfo[0];
_dice[2] = _diceinfo[2];
_dice[3] = _diceinfo[3];
_dice[4] = _diceinfo[5];
_dice[5] = _diceinfo[1];
break;
case N:
_dice[0] = _diceinfo[1];
_dice[1] = _diceinfo[5];
_dice[2] = _diceinfo[2];
_dice[3] = _diceinfo[3];
_dice[4] = _diceinfo[0];
_dice[5] = _diceinfo[4];
break;
case E:
_dice[0] = _diceinfo[3];
_dice[1] = _diceinfo[1];
_dice[2] = _diceinfo[0];
_dice[3] = _diceinfo[5];
_dice[4] = _diceinfo[4];
_dice[5] = _diceinfo[2];
break;
}
}
int getTopNum() { return _dice[0]; }
void setNum() {
for (int i = 0; i < 6; ++i) {
cin >> _dice[i];
}
}
};
int main() {
Dice dice;
dice.setNum();
string s;
cin >> s;
for (int i = 0; i < s.size(); ++i) {
if (s[i] == 'S') {
dice.roll(eRoll::S);
} else if (s[i] == 'W') {
dice.roll(eRoll::W);
} else if (s[i] == 'E') {
dice.roll(eRoll::E);
} else if (s[i] == 'N') {
dice.roll(eRoll::N);
}
}
cout << dice.getTopNum() << endl;
return 0;
}
|
delete
| 84 | 87 | 84 | 84 |
TLE
| |
p02383
|
C++
|
Runtime Error
|
#include <iostream>
#include <string>
#include <vector>
using namespace std;
struct Dice {
vector<int> faces;
Dice(vector<int> &f) : faces(f) {}
int top() { return faces.front(); }
void roll(char direction) {
int tmp;
switch (direction) {
case 'E': // 1,4,6,3 -> 4,6,3,1
tmp = faces[0];
faces[0] = faces[3];
faces[3] = faces[5];
faces[5] = faces[2];
faces[2] = tmp;
break;
case 'N': // 1,2,6,5 -> 2,6,5,1
tmp = faces[0];
faces[0] = faces[1];
faces[1] = faces[5];
faces[5] = faces[4];
faces[4] = tmp;
break;
case 'S': // 1,5,6,2 -> 5,6,2,1
tmp = faces[0];
faces[0] = faces[4];
faces[4] = faces[5];
faces[5] = faces[1];
faces[1] = tmp;
break;
case 'W': // 1,3,6,4 -> 3,6,4,1
tmp = faces[0];
faces[0] = faces[2];
faces[2] = faces[5];
faces[5] = faces[3];
faces[3] = tmp;
break;
}
}
};
int main() {
vector<int> faces;
for (int i = 0; i < 6; ++i) {
int x;
cin >> x;
faces.push_back(x);
}
Dice dice(faces);
string s;
cin >> s;
// cerr << s << endl;
for (string::iterator it = s.begin(); it != s.end(); ++it) {
dice.roll(*it);
cerr << *it << "->" << dice.top() << endl;
}
cout << dice.top() << endl;
return 0;
}
|
#include <iostream>
#include <string>
#include <vector>
using namespace std;
struct Dice {
vector<int> faces;
Dice(vector<int> &f) : faces(f) {}
int top() { return faces.front(); }
void roll(char direction) {
int tmp;
switch (direction) {
case 'E': // 1,4,6,3 -> 4,6,3,1
tmp = faces[0];
faces[0] = faces[3];
faces[3] = faces[5];
faces[5] = faces[2];
faces[2] = tmp;
break;
case 'N': // 1,2,6,5 -> 2,6,5,1
tmp = faces[0];
faces[0] = faces[1];
faces[1] = faces[5];
faces[5] = faces[4];
faces[4] = tmp;
break;
case 'S': // 1,5,6,2 -> 5,6,2,1
tmp = faces[0];
faces[0] = faces[4];
faces[4] = faces[5];
faces[5] = faces[1];
faces[1] = tmp;
break;
case 'W': // 1,3,6,4 -> 3,6,4,1
tmp = faces[0];
faces[0] = faces[2];
faces[2] = faces[5];
faces[5] = faces[3];
faces[3] = tmp;
break;
}
}
};
int main() {
vector<int> faces;
for (int i = 0; i < 6; ++i) {
int x;
cin >> x;
faces.push_back(x);
}
Dice dice(faces);
string s;
cin >> s;
// cerr << s << endl;
for (string::iterator it = s.begin(); it != s.end(); ++it) {
dice.roll(*it);
// cerr << *it << "->" << dice.top() << endl;
}
cout << dice.top() << endl;
return 0;
}
|
replace
| 63 | 64 | 63 | 64 |
0
|
S->16
E->8
|
p02383
|
C++
|
Runtime Error
|
#include <cstdio>
#define LABEL_MAX 100
#define LABEL_MIN 0
#define ORDER_MAX 100
#define ORDER_MIN 0
class Dice {
public:
Dice();
int roll(int NSEW);
int GetLabel(void);
int PrintLabel(void);
private:
int top, south, east, north, west, bottom;
int label[6];
};
Dice::Dice() {
top = 0;
south = 1;
east = 2;
west = 3;
north = 4;
bottom = 5;
}
int Dice::roll(int NSEW) {
int cpy = top;
if (NSEW == 'N') {
top = south;
south = bottom;
bottom = north;
north = cpy;
} else if (NSEW == 'S') {
top = north;
north = bottom;
bottom = south;
south = cpy;
} else if (NSEW == 'E') {
top = west;
west = bottom;
bottom = east;
east = cpy;
} else if (NSEW == 'W') {
top = east;
east = bottom;
bottom = west;
west = cpy;
} else {
return -1;
}
return 0;
}
int Dice::GetLabel(void) {
for (int i = 0; i < 6; i++) {
scanf("%d", &label[i]);
if ((label[i] > LABEL_MAX) || (label[i] < LABEL_MIN)) {
return -1;
}
}
return 0;
}
int Dice::PrintLabel(void) {
switch (top) {
case 0:
printf("%d\n", label[0]);
break;
case 1:
printf("%d\n", label[1]);
break;
case 2:
printf("%d\n", label[2]);
break;
case 3:
printf("%d\n", label[3]);
break;
case 4:
printf("%d\n", label[4]);
break;
case 5:
printf("%d\n", label[5]);
break;
default:
break;
}
return 0;
}
int main(void) {
Dice dice;
char c;
if (dice.GetLabel() == 0) {
for (int i = 0; scanf("%c", &c) == 1; i++) {
dice.roll(c);
if ((i < ORDER_MIN) || (i > ORDER_MAX)) {
return -1;
}
}
} else {
return -1;
}
dice.PrintLabel();
return 0;
}
|
#include <cstdio>
#define LABEL_MAX 100
#define LABEL_MIN 0
#define ORDER_MAX 100
#define ORDER_MIN 0
class Dice {
public:
Dice();
int roll(int NSEW);
int GetLabel(void);
int PrintLabel(void);
private:
int top, south, east, north, west, bottom;
int label[6];
};
Dice::Dice() {
top = 0;
south = 1;
east = 2;
west = 3;
north = 4;
bottom = 5;
}
int Dice::roll(int NSEW) {
int cpy = top;
if (NSEW == 'N') {
top = south;
south = bottom;
bottom = north;
north = cpy;
} else if (NSEW == 'S') {
top = north;
north = bottom;
bottom = south;
south = cpy;
} else if (NSEW == 'E') {
top = west;
west = bottom;
bottom = east;
east = cpy;
} else if (NSEW == 'W') {
top = east;
east = bottom;
bottom = west;
west = cpy;
} else {
return -1;
}
return 0;
}
int Dice::GetLabel(void) {
for (int i = 0; i < 6; i++) {
scanf("%d", &label[i]);
if ((label[i] > LABEL_MAX) || (label[i] < LABEL_MIN)) {
return -1;
}
}
return 0;
}
int Dice::PrintLabel(void) {
switch (top) {
case 0:
printf("%d\n", label[0]);
break;
case 1:
printf("%d\n", label[1]);
break;
case 2:
printf("%d\n", label[2]);
break;
case 3:
printf("%d\n", label[3]);
break;
case 4:
printf("%d\n", label[4]);
break;
case 5:
printf("%d\n", label[5]);
break;
default:
break;
}
return 0;
}
int main(void) {
Dice dice;
char c;
if (dice.GetLabel() == 0) {
for (int i = 0; scanf("%c", &c) == 1; i++) {
if (dice.roll(c) == 0) {
if ((i < ORDER_MIN) || (i > ORDER_MAX)) {
return -1;
}
}
}
} else {
return -1;
}
dice.PrintLabel();
return 0;
}
|
replace
| 102 | 105 | 102 | 106 |
0
| |
p02384
|
C++
|
Runtime Error
|
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
#define rep2(x, from, to) for (int x = (from); (x) < (to); (x)++)
#define rep(x, to) rep2(x, 0, to)
int main() {
int a[6], head, down;
rep(i, 6) { cin >> a[i]; }
int s[6][6];
s[0][0] = -1, s[0][1] = 2, s[0][2] = 4, s[0][3] = 1, s[0][4] = 3,
s[0][5] = -1;
s[1][0] = 3, s[1][1] = -1, s[1][2] = 0, s[1][3] = 5, s[1][4] = -1,
s[1][5] = 2;
s[2][0] = 1, s[2][1] = 5, s[2][2] = -1, s[2][3] = -1, s[2][4] = 0,
s[2][5] = 4;
rep2(i, 3, 6) {
rep(j, 6) { s[i][j] = s[5 - i][5 - j]; }
}
int q;
cin >> q;
rep(i, q) {
cin >> head >> down;
cout << a[s[head - 1][down - 1]] << endl;
}
return 0;
}
|
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
#define rep2(x, from, to) for (int x = (from); (x) < (to); (x)++)
#define rep(x, to) rep2(x, 0, to)
int main() {
int a[6], head, down;
rep(i, 6) { cin >> a[i]; }
int s[6][6];
s[0][0] = -1, s[0][1] = 2, s[0][2] = 4, s[0][3] = 1, s[0][4] = 3,
s[0][5] = -1;
s[1][0] = 3, s[1][1] = -1, s[1][2] = 0, s[1][3] = 5, s[1][4] = -1,
s[1][5] = 2;
s[2][0] = 1, s[2][1] = 5, s[2][2] = -1, s[2][3] = -1, s[2][4] = 0,
s[2][5] = 4;
rep2(i, 3, 6) {
rep(j, 6) { s[i][j] = s[5 - i][5 - j]; }
}
int q;
cin >> q;
rep(i, q) {
cin >> head >> down;
int b, c;
rep(i, 6) {
if (a[i] == head)
b = i;
else if (a[i] == down)
c = i;
}
cout << a[s[b][c]] << endl;
}
return 0;
}
|
replace
| 23 | 24 | 23 | 31 |
0
| |
p02384
|
C++
|
Time Limit Exceeded
|
#include <array>
#include <iostream>
using namespace std;
class Dice {
private:
int temp;
public:
array<int, 7> d;
void set_eyes(int v1, int v2, int v3, int v4, int v5, int v6) {
d[1] = v1;
d[2] = v2;
d[3] = v3;
d[4] = v4;
d[5] = v5;
d[6] = v6;
}
void rotate(char direction) {
switch (direction) {
case 'N':
temp = d[1];
d[1] = d[2];
d[2] = d[6];
d[6] = d[5];
d[5] = temp;
break;
case 'E':
temp = d[1];
d[1] = d[4];
d[4] = d[6];
d[6] = d[3];
d[3] = temp;
break;
case 'S':
temp = d[1];
d[1] = d[5];
d[5] = d[6];
d[6] = d[2];
d[2] = temp;
break;
case 'W':
temp = d[1];
d[1] = d[3];
d[3] = d[6];
d[6] = d[4];
d[4] = temp;
break;
}
}
int return_top() { return d[1]; }
int return_front() { return d[2]; }
int return_right() { return d[3]; }
};
int main() {
int v1, v2, v3, v4, v5, v6 = {};
int n;
int t, f = {}; // top and front
string directions;
cin >> v1 >> v2 >> v3 >> v4 >> v5 >> v6;
cin >> n;
Dice Dice1;
for (int i = 0; i < n; i++) {
Dice1.set_eyes(v1, v2, v3, v4, v5, v6);
cin >> t >> f;
while (Dice1.return_top() != t || Dice1.return_front() != f) {
for (int s = 0; s < 5; s++) {
if (Dice1.return_top() == t && Dice1.return_front() == f)
break;
Dice1.rotate('N');
}
for (int s = 0; s < 5; s++) {
if (Dice1.return_top() == t && Dice1.return_front() == f)
break;
Dice1.rotate('E');
}
}
cout << Dice1.return_right() << endl;
}
return 0;
}
|
#include <array>
#include <iostream>
using namespace std;
class Dice {
private:
int temp;
public:
array<int, 7> d;
void set_eyes(int v1, int v2, int v3, int v4, int v5, int v6) {
d[1] = v1;
d[2] = v2;
d[3] = v3;
d[4] = v4;
d[5] = v5;
d[6] = v6;
}
void rotate(char direction) {
switch (direction) {
case 'N':
temp = d[1];
d[1] = d[2];
d[2] = d[6];
d[6] = d[5];
d[5] = temp;
break;
case 'E':
temp = d[1];
d[1] = d[4];
d[4] = d[6];
d[6] = d[3];
d[3] = temp;
break;
case 'S':
temp = d[1];
d[1] = d[5];
d[5] = d[6];
d[6] = d[2];
d[2] = temp;
break;
case 'W':
temp = d[1];
d[1] = d[3];
d[3] = d[6];
d[6] = d[4];
d[4] = temp;
break;
}
}
int return_top() { return d[1]; }
int return_front() { return d[2]; }
int return_right() { return d[3]; }
};
int main() {
int v1, v2, v3, v4, v5, v6 = {};
int n;
int t, f = {}; // top and front
string directions;
cin >> v1 >> v2 >> v3 >> v4 >> v5 >> v6;
cin >> n;
Dice Dice1;
for (int i = 0; i < n; i++) {
Dice1.set_eyes(v1, v2, v3, v4, v5, v6);
cin >> t >> f;
while (Dice1.return_top() != t || Dice1.return_front() != f) {
for (int s = 0; s < 5; s++) {
if (Dice1.return_top() == t && Dice1.return_front() == f)
break;
Dice1.rotate('N');
}
for (int s = 0; s < 5; s++) {
if (Dice1.return_top() == t && Dice1.return_front() == f)
break;
Dice1.rotate('E');
}
for (int s = 0; s < 5; s++) {
if (Dice1.return_top() == t && Dice1.return_front() == f)
break;
Dice1.rotate('S');
}
for (int s = 0; s < 5; s++) {
if (Dice1.return_top() == t && Dice1.return_front() == f)
break;
Dice1.rotate('W');
}
}
cout << Dice1.return_right() << endl;
}
return 0;
}
|
insert
| 86 | 86 | 86 | 96 |
TLE
| |
p02384
|
C++
|
Time Limit Exceeded
|
#include <cstdio>
#include <iostream>
using namespace std;
struct dice {
int q1, q2, q3, q4, q5, q6;
};
void mN(dice &d) {
int tmp = d.q1;
d.q1 = d.q2;
d.q2 = d.q6;
d.q6 = d.q5;
d.q5 = tmp;
}
void mE(dice &d) {
int tmp = d.q1;
d.q1 = d.q4;
d.q4 = d.q6;
d.q6 = d.q3;
d.q3 = tmp;
}
void mW(dice &d) {
int tmp = d.q1;
d.q1 = d.q3;
d.q3 = d.q6;
d.q6 = d.q4;
d.q4 = tmp;
}
void mS(dice &d) {
int tmp = d.q1;
d.q1 = d.q5;
d.q5 = d.q6;
d.q6 = d.q2;
d.q2 = tmp;
}
void spin(dice &d) {
int tmp = d.q2;
d.q2 = d.q3;
d.q3 = d.q5;
d.q5 = d.q4;
d.q4 = tmp;
}
int main() {
dice z;
int q;
scanf(" %d %d %d %d %d %d", &z.q1, &z.q2, &z.q3, &z.q4, &z.q5, &z.q6);
scanf(" %d", &q);
for (int i = 0; i < q; ++i) {
int a, b;
dice x = z;
scanf(" %d %d", &a, &b);
if (a == 3 || a == 4)
mE(x);
while (a != x.q1)
mN(x);
while (b != x.q2)
spin(x);
printf("%d\n", x.q3);
}
return 0;
}
|
#include <cstdio>
#include <iostream>
using namespace std;
struct dice {
int q1, q2, q3, q4, q5, q6;
};
void mN(dice &d) {
int tmp = d.q1;
d.q1 = d.q2;
d.q2 = d.q6;
d.q6 = d.q5;
d.q5 = tmp;
}
void mE(dice &d) {
int tmp = d.q1;
d.q1 = d.q4;
d.q4 = d.q6;
d.q6 = d.q3;
d.q3 = tmp;
}
void mW(dice &d) {
int tmp = d.q1;
d.q1 = d.q3;
d.q3 = d.q6;
d.q6 = d.q4;
d.q4 = tmp;
}
void mS(dice &d) {
int tmp = d.q1;
d.q1 = d.q5;
d.q5 = d.q6;
d.q6 = d.q2;
d.q2 = tmp;
}
void spin(dice &d) {
int tmp = d.q2;
d.q2 = d.q3;
d.q3 = d.q5;
d.q5 = d.q4;
d.q4 = tmp;
}
int main() {
dice z;
int q;
scanf(" %d %d %d %d %d %d", &z.q1, &z.q2, &z.q3, &z.q4, &z.q5, &z.q6);
scanf(" %d", &q);
for (int i = 0; i < q; ++i) {
int a, b;
dice x = z;
scanf(" %d %d", &a, &b);
if (a == x.q3 || a == x.q4)
mE(x);
while (a != x.q1)
mN(x);
while (b != x.q2)
spin(x);
printf("%d\n", x.q3);
}
return 0;
}
|
replace
| 60 | 61 | 60 | 61 |
TLE
| |
p02384
|
C++
|
Runtime Error
|
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int dice(int a, int b) {
int count = 0;
string tpat[3];
tpat[0] = "12651";
tpat[1] = "23542";
tpat[2] = "13641";
int ret[3];
ret[0] = 3;
ret[1] = 1;
ret[2] = 5;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 4; j++) {
if (tpat[i][j] - '0' == a && tpat[i][j + 1] - '0' == b) {
return ret[i];
}
}
}
tpat[0] = "15621";
tpat[1] = "24532";
tpat[2] = "14631";
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 4; j++) {
if (tpat[i][j] - '0' == a && tpat[i][j + 1] - '0' == b) {
return 7 - ret[i];
}
}
}
}
int main(int argc, char const *argv[]) {
int d[6];
for (int i = 0; i < 6; i++) {
cin >> d[i];
}
int n;
cin >> n;
for (int i = 0; i < n; i++) {
int a, b;
cin >> a >> b;
cout << d[dice(a, b) - 1] << endl;
}
return 0;
}
|
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int dice(int a, int b) {
int count = 0;
string tpat[3];
tpat[0] = "12651";
tpat[1] = "23542";
tpat[2] = "13641";
int ret[3];
ret[0] = 3;
ret[1] = 1;
ret[2] = 5;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 4; j++) {
if (tpat[i][j] - '0' == a && tpat[i][j + 1] - '0' == b) {
return ret[i];
}
}
}
tpat[0] = "15621";
tpat[1] = "24532";
tpat[2] = "14631";
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 4; j++) {
if (tpat[i][j] - '0' == a && tpat[i][j + 1] - '0' == b) {
return 7 - ret[i];
}
}
}
}
int main(int argc, char const *argv[]) {
int d[6];
for (int i = 0; i < 6; i++) {
cin >> d[i];
}
int n;
cin >> n;
for (int i = 0; i < n; i++) {
int a, b;
cin >> a >> b;
int a1, b1;
for (int i = 0; i < 6; i++) {
if (d[i] == a)
a1 = i;
if (d[i] == b)
b1 = i;
}
cout << d[dice(a1 + 1, b1 + 1) - 1] << endl;
}
return 0;
}
|
replace
| 45 | 46 | 45 | 53 |
0
| |
p02385
|
C++
|
Time Limit Exceeded
|
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
const int inf = 0x7fffffff;
typedef long long int ll;
using namespace std;
char s[100 + 10];
char ans[][10] = {"No\n", "Yes\n"};
struct DICE {
int u, s, e, w, n, d;
DICE(int u = 0, int s = 0, int e = 0, int w = 0, int n = 0, int d = 0)
: u(u), s(s), e(e), w(w), n(n), d(d) {}
DICE fW() {
DICE tmp;
tmp.s = this->s;
tmp.n = this->n;
tmp.e = this->d;
tmp.w = this->u;
tmp.u = this->e;
tmp.d = this->w;
return tmp;
}
DICE fS() {
DICE tmp;
tmp.s = this->u;
tmp.n = this->d;
tmp.e = this->e;
tmp.w = this->w;
tmp.d = this->s;
tmp.u = this->n;
return tmp;
}
DICE fE() {
DICE tmp;
tmp.s = this->s;
tmp.n = this->n;
tmp.e = this->u;
tmp.w = this->d;
tmp.d = this->e;
tmp.u = this->w;
return tmp;
}
DICE fN() {
DICE tmp;
tmp.s = this->d;
tmp.n = this->u;
tmp.e = this->e;
tmp.w = this->w;
tmp.d = this->n;
tmp.u = this->s;
return tmp;
}
int right(int t, int f) {
if (t == this->u) {
if (f == this->s)
return this->e;
else if (f == this->e)
return this->n;
else if (f == this->n)
return this->w;
else if (f == this->w)
return this->s;
else
return -1;
} else if (t == this->s) {
DICE tmp = (*this).fN();
return tmp.right(t, f);
} else if (t == this->e) {
DICE tmp = (*this).fW();
return tmp.right(t, f);
} else if (t == this->n) {
DICE tmp = (*this).fS();
return tmp.right(t, f);
} else if (t == this->w) {
DICE tmp = (*this).fE();
return tmp.right(t, f);
} else if (t == this->d) {
DICE tmp = (*this).fE().fE();
return tmp.right(t, f);
} else
return -1;
}
};
bool check(DICE x, DICE y) {
int ax[] = {x.s, x.e, x.n, x.w};
int ay[] = {y.s, y.e, y.n, y.w};
if (x.u == y.u) {
if (x.d == y.d) {
int cnt = 0;
while (cnt <= 4) {
while (ax[cnt] != ay[0] && cnt <= 4)
cnt++;
int i = 0;
while (ax[(i + cnt) % 4] == ay[i] && i <= 4)
i++;
if (i == 4)
return 1;
}
}
}
return 0;
}
bool sovle(DICE x, DICE y) {
if (check(x, y))
return 1;
if (check(x.fE(), y))
return 1;
if (check(x.fW(), y))
return 1;
if (check(x.fN(), y))
return 1;
if (check(x.fS(), y))
return 1;
if (check(x.fS().fS(), y))
return 1;
return 0;
}
int main() {
// #ifdef DEBUG
// freopen("in", "r", stdin);
//// freopen("out", "w", stdout);
// #endif
int a[6];
for (int i = 0; i < 6; i++) {
scanf("%d", &a[i]);
}
DICE dice(a[0], a[1], a[2], a[3], a[4], a[5]);
for (int i = 0; i < 6; i++) {
scanf("%d", &a[i]);
}
DICE dice2(a[0], a[1], a[2], a[3], a[4], a[5]);
printf("%s", ans[sovle(dice, dice2)]);
// printf("%s", ans[solve(dice,dice2)]);
// DICE I
// scanf("%s", s);
// int len=strlen(s);
// for(int i=0;i<len;i++){
// switch(s[i]){
// case'S':dice=dice.fS();break;
// case'E':dice=dice.fE();break;
// case'W':dice=dice.fW();break;
// case'N':dice=dice.fN();break;
// }
// }
// printf("%d\n", dice.u);
//
return 0;
}
// aoj1_11_a.cc
// AC
|
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
const int inf = 0x7fffffff;
typedef long long int ll;
using namespace std;
char s[100 + 10];
char ans[][10] = {"No\n", "Yes\n"};
struct DICE {
int u, s, e, w, n, d;
DICE(int u = 0, int s = 0, int e = 0, int w = 0, int n = 0, int d = 0)
: u(u), s(s), e(e), w(w), n(n), d(d) {}
DICE fW() {
DICE tmp;
tmp.s = this->s;
tmp.n = this->n;
tmp.e = this->d;
tmp.w = this->u;
tmp.u = this->e;
tmp.d = this->w;
return tmp;
}
DICE fS() {
DICE tmp;
tmp.s = this->u;
tmp.n = this->d;
tmp.e = this->e;
tmp.w = this->w;
tmp.d = this->s;
tmp.u = this->n;
return tmp;
}
DICE fE() {
DICE tmp;
tmp.s = this->s;
tmp.n = this->n;
tmp.e = this->u;
tmp.w = this->d;
tmp.d = this->e;
tmp.u = this->w;
return tmp;
}
DICE fN() {
DICE tmp;
tmp.s = this->d;
tmp.n = this->u;
tmp.e = this->e;
tmp.w = this->w;
tmp.d = this->n;
tmp.u = this->s;
return tmp;
}
int right(int t, int f) {
if (t == this->u) {
if (f == this->s)
return this->e;
else if (f == this->e)
return this->n;
else if (f == this->n)
return this->w;
else if (f == this->w)
return this->s;
else
return -1;
} else if (t == this->s) {
DICE tmp = (*this).fN();
return tmp.right(t, f);
} else if (t == this->e) {
DICE tmp = (*this).fW();
return tmp.right(t, f);
} else if (t == this->n) {
DICE tmp = (*this).fS();
return tmp.right(t, f);
} else if (t == this->w) {
DICE tmp = (*this).fE();
return tmp.right(t, f);
} else if (t == this->d) {
DICE tmp = (*this).fE().fE();
return tmp.right(t, f);
} else
return -1;
}
};
bool check(DICE x, DICE y) {
int ax[] = {x.s, x.e, x.n, x.w};
int ay[] = {y.s, y.e, y.n, y.w};
if (x.u == y.u) {
if (x.d == y.d) {
int cnt = 0;
while (cnt <= 4) {
while (ax[cnt] != ay[0] && cnt <= 4)
cnt++;
int i = 0;
while (ax[(i + cnt) % 4] == ay[i] && i <= 4)
i++;
if (i == 4)
return 1;
cnt++;
}
}
}
return 0;
}
bool sovle(DICE x, DICE y) {
if (check(x, y))
return 1;
if (check(x.fE(), y))
return 1;
if (check(x.fW(), y))
return 1;
if (check(x.fN(), y))
return 1;
if (check(x.fS(), y))
return 1;
if (check(x.fS().fS(), y))
return 1;
return 0;
}
int main() {
// #ifdef DEBUG
// freopen("in", "r", stdin);
//// freopen("out", "w", stdout);
// #endif
int a[6];
for (int i = 0; i < 6; i++) {
scanf("%d", &a[i]);
}
DICE dice(a[0], a[1], a[2], a[3], a[4], a[5]);
for (int i = 0; i < 6; i++) {
scanf("%d", &a[i]);
}
DICE dice2(a[0], a[1], a[2], a[3], a[4], a[5]);
printf("%s", ans[sovle(dice, dice2)]);
// printf("%s", ans[solve(dice,dice2)]);
// DICE I
// scanf("%s", s);
// int len=strlen(s);
// for(int i=0;i<len;i++){
// switch(s[i]){
// case'S':dice=dice.fS();break;
// case'E':dice=dice.fE();break;
// case'W':dice=dice.fW();break;
// case'N':dice=dice.fN();break;
// }
// }
// printf("%d\n", dice.u);
//
return 0;
}
// aoj1_11_a.cc
// AC
|
insert
| 106 | 106 | 106 | 107 |
TLE
| |
p02385
|
C++
|
Runtime Error
|
#include <iostream>
int memo[7][7] = {-1};
int x[3][5] = {{1, 2, 6, 5, 1}, {1, 3, 6, 4, 1}, {2, 3, 5, 4, 2}};
int sides[3][2] = {{4, 3}, {2, 5}, {6, 1}};
int main() {
int dice_a[7], dice_b[7];
int top, front, q;
char command;
for (int i = 1; i < 7; i++)
std::cin >> dice_a[i];
for (int i = 1; i < 7; i++)
std::cin >> dice_b[i];
for (int j = 0; j < 3; j++) {
for (int i = 1; i < 5; i++) {
memo[dice_a[x[j][i]]][dice_a[x[j][i - 1]]] = dice_a[sides[j][0]];
memo[dice_a[x[j][i - 1]]][dice_a[x[j][i]]] = dice_a[sides[j][1]];
}
}
if (memo[dice_b[1]][dice_b[2]] == dice_b[3] &&
memo[dice_b[2]][dice_b[1]] == dice_b[4]) {
std::cout << "Yes" << std::endl;
} else {
std::cout << "No" << std::endl;
}
return 0;
}
|
#include <iostream>
int memo[101][101] = {-1};
int x[3][5] = {{1, 2, 6, 5, 1}, {1, 3, 6, 4, 1}, {2, 3, 5, 4, 2}};
int sides[3][2] = {{4, 3}, {2, 5}, {6, 1}};
int main() {
int dice_a[7], dice_b[7];
int top, front, q;
char command;
for (int i = 1; i < 7; i++)
std::cin >> dice_a[i];
for (int i = 1; i < 7; i++)
std::cin >> dice_b[i];
for (int j = 0; j < 3; j++) {
for (int i = 1; i < 5; i++) {
memo[dice_a[x[j][i]]][dice_a[x[j][i - 1]]] = dice_a[sides[j][0]];
memo[dice_a[x[j][i - 1]]][dice_a[x[j][i]]] = dice_a[sides[j][1]];
}
}
if (memo[dice_b[1]][dice_b[2]] == dice_b[3] &&
memo[dice_b[2]][dice_b[1]] == dice_b[4]) {
std::cout << "Yes" << std::endl;
} else {
std::cout << "No" << std::endl;
}
return 0;
}
|
replace
| 2 | 3 | 2 | 3 |
0
| |
p02385
|
C++
|
Time Limit Exceeded
|
#include <iostream>
using namespace std;
class dice {
public:
int _1, _2, _3, _4, _5, _6, sus;
void moveN() {
sus = _1;
_1 = _2;
_2 = _6;
_6 = _5;
_5 = sus;
}
void moveE() {
sus = _1;
_1 = _4;
_4 = _6;
_6 = _3;
_3 = sus;
}
void moveW() {
sus = _1;
_1 = _3;
_3 = _6;
_6 = _4;
_4 = sus;
}
void moveS() {
sus = _1;
_1 = _5;
_5 = _6;
_6 = _2;
_2 = sus;
}
void spin() {
sus = _2;
_2 = _3;
_3 = _5;
_5 = _4;
_4 = sus;
}
};
int main() {
dice d1;
dice d2;
int i;
cin >> d1._1 >> d1._2 >> d1._3 >> d1._4 >> d1._5 >> d1._6;
cin >> d2._1 >> d2._2 >> d2._3 >> d2._4 >> d2._5 >> d2._6;
if (d1._3 == d2._1 || d1._4 == d2._1)
d1.moveE();
for (i = 0; i < 4; i++) {
if (d2._1 == d1._1)
break;
d1.moveN();
}
for (i = 0; i < 4 || d2._2 != d1._2; i++) {
if (d2._2 == d1._2)
break;
d1.spin();
}
if (d1._1 == d2._1 && d1._2 == d2._2 && d1._3 == d2._3 && d1._4 == d2._4 &&
d1._5 == d2._5 && d1._6 == d2._6)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
|
#include <iostream>
using namespace std;
class dice {
public:
int _1, _2, _3, _4, _5, _6, sus;
void moveN() {
sus = _1;
_1 = _2;
_2 = _6;
_6 = _5;
_5 = sus;
}
void moveE() {
sus = _1;
_1 = _4;
_4 = _6;
_6 = _3;
_3 = sus;
}
void moveW() {
sus = _1;
_1 = _3;
_3 = _6;
_6 = _4;
_4 = sus;
}
void moveS() {
sus = _1;
_1 = _5;
_5 = _6;
_6 = _2;
_2 = sus;
}
void spin() {
sus = _2;
_2 = _3;
_3 = _5;
_5 = _4;
_4 = sus;
}
};
int main() {
dice d1;
dice d2;
int i;
cin >> d1._1 >> d1._2 >> d1._3 >> d1._4 >> d1._5 >> d1._6;
cin >> d2._1 >> d2._2 >> d2._3 >> d2._4 >> d2._5 >> d2._6;
if (d1._3 == d2._1 || d1._4 == d2._1)
d1.moveE();
for (i = 0; i < 4; i++) {
if (d2._1 == d1._1)
break;
d1.moveN();
}
for (i = 0; i < 4; i++) {
if (d2._2 == d1._2)
break;
d1.spin();
}
if (d1._1 == d2._1 && d1._2 == d2._2 && d1._3 == d2._3 && d1._4 == d2._4 &&
d1._5 == d2._5 && d1._6 == d2._6)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
|
replace
| 66 | 67 | 66 | 67 |
TLE
| |
p02385
|
C++
|
Time Limit Exceeded
|
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
using namespace std;
class Dice {
private:
int face[6];
public:
int getTop();
int getFace(int);
void setFace(int label, int value);
void turnOver(char dir);
void debugOut();
};
int Dice::getTop() { return face[0]; }
int Dice::getFace(int i) { return face[i]; }
void Dice::setFace(int label, int value) {
if (label > 5)
return;
face[label] = value;
}
void Dice::turnOver(char c) {
int tmp;
if (c == 'N') {
tmp = face[0];
face[0] = face[1];
face[1] = face[5];
face[5] = face[4];
face[4] = tmp; // face[0]
}
if (c == 'S') {
tmp = face[0];
face[0] = face[4];
face[4] = face[5];
face[5] = face[1];
face[1] = tmp; // face[0]
}
if (c == 'E') {
tmp = face[0];
face[0] = face[3];
face[3] = face[5];
face[5] = face[2];
face[2] = tmp; // face[4]
}
if (c == 'W') {
tmp = face[0];
face[0] = face[2];
face[2] = face[5];
face[5] = face[3];
face[3] = tmp; // face[4]
}
}
void Dice::debugOut() {
for (int i = 0; i < 6; i++)
printf("%d,", face[i]);
putchar('\n');
}
int main() {
Dice dice;
Dice dice2;
int l, count_n = 0;
for (int i = 0; i < 6; i++) {
scanf("%d ", &l);
dice.setFace(i, l);
}
for (int i = 0; i < 6; i++) {
scanf("%d ", &l);
dice2.setFace(i, l);
}
for (;;) {
if (dice.getFace(0) == dice2.getFace(0)) {
if (dice.getFace(1) == dice2.getFace(1)) {
if (dice.getFace(2) == dice2.getFace(2)) {
if (dice.getFace(3) == dice2.getFace(3)) {
if (dice.getFace(4) == dice2.getFace(4)) {
if (dice.getFace(5) == dice2.getFace(5)) {
puts("Yes");
return 0;
} else {
puts("No");
return 0;
}
}
} else {
dice2.turnOver('E');
dice2.turnOver('S');
dice2.turnOver('S');
}
}
} else {
dice2.turnOver('W');
dice2.turnOver('S');
dice2.turnOver('E');
}
} else {
if (count_n < 3) {
dice2.turnOver('N');
count_n++;
} else {
count_n = 0;
dice2.turnOver('E');
}
}
}
}
|
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
using namespace std;
class Dice {
private:
int face[6];
public:
int getTop();
int getFace(int);
void setFace(int label, int value);
void turnOver(char dir);
void debugOut();
};
int Dice::getTop() { return face[0]; }
int Dice::getFace(int i) { return face[i]; }
void Dice::setFace(int label, int value) {
if (label > 5)
return;
face[label] = value;
}
void Dice::turnOver(char c) {
int tmp;
if (c == 'N') {
tmp = face[0];
face[0] = face[1];
face[1] = face[5];
face[5] = face[4];
face[4] = tmp; // face[0]
}
if (c == 'S') {
tmp = face[0];
face[0] = face[4];
face[4] = face[5];
face[5] = face[1];
face[1] = tmp; // face[0]
}
if (c == 'E') {
tmp = face[0];
face[0] = face[3];
face[3] = face[5];
face[5] = face[2];
face[2] = tmp; // face[4]
}
if (c == 'W') {
tmp = face[0];
face[0] = face[2];
face[2] = face[5];
face[5] = face[3];
face[3] = tmp; // face[4]
}
}
void Dice::debugOut() {
for (int i = 0; i < 6; i++)
printf("%d,", face[i]);
putchar('\n');
}
int main() {
Dice dice;
Dice dice2;
int l, count_n = 0;
for (int i = 0; i < 6; i++) {
scanf("%d ", &l);
dice.setFace(i, l);
}
for (int i = 0; i < 6; i++) {
scanf("%d ", &l);
dice2.setFace(i, l);
}
for (;;) {
if (dice.getFace(0) == dice2.getFace(0)) {
if (dice.getFace(1) == dice2.getFace(1)) {
if (dice.getFace(2) == dice2.getFace(2)) {
if (dice.getFace(3) == dice2.getFace(3)) {
if (dice.getFace(4) == dice2.getFace(4)) {
if (dice.getFace(5) == dice2.getFace(5)) {
puts("Yes");
return 0;
} else {
puts("No");
return 0;
}
}
} else {
dice2.turnOver('E');
dice2.turnOver('S');
dice2.turnOver('S');
}
} else {
puts("No");
return 0;
}
} else {
dice2.turnOver('W');
dice2.turnOver('S');
dice2.turnOver('E');
}
} else {
if (count_n < 3) {
dice2.turnOver('N');
count_n++;
} else {
count_n = 0;
dice2.turnOver('E');
}
}
}
}
|
insert
| 105 | 105 | 105 | 108 |
TLE
| |
p02385
|
C++
|
Runtime Error
|
#include <algorithm>
#include <bits/stdc++.h>
#include <vector>
using namespace std;
int main() {
int d1[7], d2[7];
scanf("%d %d %d %d %d %d", &d1[0], &d1[1], &d1[2], &d1[3], &d1[4], &d1[5]);
scanf("%d %d %d %d %d %d", &d2[0], &d2[1], &d2[2], &d2[3], &d2[4], &d2[5]);
for (int i = 0; i < 4; i++) {
int tmp1 = d1[0];
d1[0] = d1[2];
d1[2] = d1[5];
d1[5] = d1[3];
d1[3] = tmp1;
for (int j = 0; j < 4; j++) {
int tmp2 = d1[0];
d1[0] = d1[1];
d1[1] = d1[5];
d1[5] = d1[4];
d1[4] = tmp2;
for (int k = 0; k < 4; k++) {
int tmp3 = d1[1];
d1[1] = d1[2];
d1[2] = d1[4];
d1[4] = d1[3];
d1[3] = tmp3;
int chk = 0;
for (int p = 0; p < 6; p++) {
if (d1[p] != d2[p]) {
break;
} else {
chk++;
}
if (chk == 6) {
printf("Yes\n");
return 1;
}
}
}
}
}
printf("No\n");
return 0;
}
|
#include <algorithm>
#include <bits/stdc++.h>
#include <vector>
using namespace std;
int main() {
int d1[7], d2[7];
scanf("%d %d %d %d %d %d", &d1[0], &d1[1], &d1[2], &d1[3], &d1[4], &d1[5]);
scanf("%d %d %d %d %d %d", &d2[0], &d2[1], &d2[2], &d2[3], &d2[4], &d2[5]);
for (int i = 0; i < 4; i++) {
int tmp1 = d1[0];
d1[0] = d1[2];
d1[2] = d1[5];
d1[5] = d1[3];
d1[3] = tmp1;
for (int j = 0; j < 4; j++) {
int tmp2 = d1[0];
d1[0] = d1[1];
d1[1] = d1[5];
d1[5] = d1[4];
d1[4] = tmp2;
for (int k = 0; k < 4; k++) {
int tmp3 = d1[1];
d1[1] = d1[2];
d1[2] = d1[4];
d1[4] = d1[3];
d1[3] = tmp3;
int chk = 0;
for (int p = 0; p < 6; p++) {
if (d1[p] != d2[p]) {
break;
} else {
chk++;
}
if (chk == 6) {
printf("Yes\n");
return 0;
}
}
}
}
}
printf("No\n");
return 0;
}
|
replace
| 37 | 38 | 37 | 38 |
1
| |
p02385
|
C++
|
Time Limit Exceeded
|
#include <iostream>
using namespace std;
int color[6];
class DICE {
public:
void set_num(int a[]) {
for (int i = 0; i < 6; i++) {
dicenum[i] = a[i];
}
}
void make_move(char c) {
int temp;
if (c == 'N') {
temp = dicenum[4];
dicenum[4] = dicenum[0];
dicenum[0] = dicenum[1];
dicenum[1] = dicenum[5];
dicenum[5] = temp;
}
if (c == 'S') {
temp = dicenum[1];
dicenum[1] = dicenum[0];
dicenum[0] = dicenum[4];
dicenum[4] = dicenum[5];
dicenum[5] = temp;
}
if (c == 'E') {
temp = dicenum[2];
dicenum[2] = dicenum[0];
dicenum[0] = dicenum[3];
dicenum[3] = dicenum[5];
dicenum[5] = temp;
}
if (c == 'W') {
temp = dicenum[3];
dicenum[3] = dicenum[0];
dicenum[0] = dicenum[2];
dicenum[2] = dicenum[5];
dicenum[5] = temp;
}
}
void get_color() {
for (int i = 0; i < 6; i++)
color[i] = dicenum[i];
}
private:
int dicenum[6];
};
int main() {
int a[6], b[6];
bool ok = false, f;
DICE dice;
for (int i = 0; i < 6; i++)
cin >> a[i];
for (int i = 0; i < 6; i++)
cin >> b[i];
dice.set_num(a);
for (int i = 0; i < 6; i++) {
for (int j = 0; j < 6; j++) {
for (int k = 0; k < 6; k++) {
for (int l = 0; l < 6; l++) {
for (int m = 0; m <= i; m++)
dice.make_move('N');
for (int m = 0; m <= j; m++)
dice.make_move('S');
for (int m = 0; m <= k; m++)
dice.make_move('E');
for (int m = 0; m <= l; m++)
dice.make_move('W');
f = true;
dice.get_color();
for (int m = 0; m < 6; m++) {
if (color[m] != b[m])
f = false;
}
if (f) {
cout << "Yes\n";
ok = true;
i = 4;
j = 4;
k = 4;
l = 4;
}
}
}
}
}
if (!ok)
cout << "No\n";
return 0;
}
|
#include <iostream>
using namespace std;
int color[6];
class DICE {
public:
void set_num(int a[]) {
for (int i = 0; i < 6; i++) {
dicenum[i] = a[i];
}
}
void make_move(char c) {
int temp;
if (c == 'N') {
temp = dicenum[4];
dicenum[4] = dicenum[0];
dicenum[0] = dicenum[1];
dicenum[1] = dicenum[5];
dicenum[5] = temp;
}
if (c == 'S') {
temp = dicenum[1];
dicenum[1] = dicenum[0];
dicenum[0] = dicenum[4];
dicenum[4] = dicenum[5];
dicenum[5] = temp;
}
if (c == 'E') {
temp = dicenum[2];
dicenum[2] = dicenum[0];
dicenum[0] = dicenum[3];
dicenum[3] = dicenum[5];
dicenum[5] = temp;
}
if (c == 'W') {
temp = dicenum[3];
dicenum[3] = dicenum[0];
dicenum[0] = dicenum[2];
dicenum[2] = dicenum[5];
dicenum[5] = temp;
}
}
void get_color() {
for (int i = 0; i < 6; i++)
color[i] = dicenum[i];
}
private:
int dicenum[6];
};
int main() {
int a[6], b[6];
bool ok = false, f;
DICE dice;
for (int i = 0; i < 6; i++)
cin >> a[i];
for (int i = 0; i < 6; i++)
cin >> b[i];
dice.set_num(a);
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
for (int k = 0; k < 5; k++) {
for (int l = 0; l < 5; l++) {
for (int m = 0; m <= i; m++)
dice.make_move('N');
for (int m = 0; m <= j; m++)
dice.make_move('S');
for (int m = 0; m <= k; m++)
dice.make_move('E');
for (int m = 0; m <= l; m++)
dice.make_move('W');
f = true;
dice.get_color();
for (int m = 0; m < 6; m++) {
if (color[m] != b[m])
f = false;
}
if (f) {
cout << "Yes\n";
ok = true;
i = 4;
j = 4;
k = 4;
l = 4;
}
}
}
}
}
if (!ok)
cout << "No\n";
return 0;
}
|
replace
| 62 | 66 | 62 | 66 |
TLE
| |
p02386
|
C++
|
Time Limit Exceeded
|
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <string>
using namespace std;
struct dice {
int u, n, e, s, w, d;
};
int main() {
srand((unsigned)time(NULL));
int n;
dice d[100];
int tmp;
int q, a, b;
int rn;
int cnt = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> d[i].u >> d[i].s >> d[i].e >> d[i].w >> d[i].n >> d[i].d;
}
for (int i = 1; i < n; i++) {
cnt = 0;
while (1) {
rn = rand() % 4;
if (rn == 0) {
tmp = d[i].u;
d[i].u = d[i].s;
d[i].s = d[i].d;
d[i].d = d[i].n;
d[i].n = tmp;
} else if (rn == 1) {
tmp = d[i].u;
d[i].u = d[i].w;
d[i].w = d[i].d;
d[i].d = d[i].e;
d[i].e = tmp;
} else if (rn == 2) {
tmp = d[i].u;
d[i].u = d[i].n;
d[i].n = d[i].d;
d[i].d = d[i].s;
d[i].s = tmp;
} else if (rn == 3) {
tmp = d[i].u;
d[i].u = d[i].e;
d[i].e = d[i].d;
d[i].d = d[i].w;
d[i].w = tmp;
}
if (d[i].u == d[i - 1].u && d[i].w == d[i - 1].w &&
d[i].e == d[i - 1].e && d[i].s == d[i - 1].s &&
d[i].n == d[i - 1].n && d[i].d == d[i - 1].d) {
cout << "No" << endl;
return 0;
}
cnt++;
if (cnt == 1000000) {
break;
}
}
}
cout << "Yes" << endl;
}
|
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <string>
using namespace std;
struct dice {
int u, n, e, s, w, d;
};
int main() {
srand((unsigned)time(NULL));
int n;
dice d[100];
int tmp;
int q, a, b;
int rn;
int cnt = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> d[i].u >> d[i].s >> d[i].e >> d[i].w >> d[i].n >> d[i].d;
}
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
cnt = 0;
while (1) {
rn = rand() % 4;
if (rn == 0) {
tmp = d[i].u;
d[i].u = d[i].s;
d[i].s = d[i].d;
d[i].d = d[i].n;
d[i].n = tmp;
} else if (rn == 1) {
tmp = d[i].u;
d[i].u = d[i].w;
d[i].w = d[i].d;
d[i].d = d[i].e;
d[i].e = tmp;
} else if (rn == 2) {
tmp = d[i].u;
d[i].u = d[i].n;
d[i].n = d[i].d;
d[i].d = d[i].s;
d[i].s = tmp;
} else if (rn == 3) {
tmp = d[i].u;
d[i].u = d[i].e;
d[i].e = d[i].d;
d[i].d = d[i].w;
d[i].w = tmp;
}
if (d[i].u == d[j].u && d[i].w == d[j].w && d[i].e == d[j].e &&
d[i].s == d[j].s && d[i].n == d[j].n && d[i].d == d[j].d) {
cout << "No" << endl;
return 0;
}
cnt++;
if (cnt == 10000) {
break;
}
}
}
}
cout << "Yes" << endl;
}
|
replace
| 28 | 66 | 28 | 67 |
TLE
| |
p02386
|
C++
|
Time Limit Exceeded
|
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
const int COUNT = 6;
class Dice {
public:
int num[6];
public:
Dice();
void play_dice(string);
void play(int, int, int, int);
void print_(int x) { printf("%d\n", num[x]); }
void to_top_and_front(int, int);
};
Dice::Dice() {
for (int i = 0; i < COUNT; ++i) {
cin >> num[i];
}
}
void Dice::play_dice(string s) {
if (s == "E") {
play(0, 2, 5, 3);
}
if (s == "N") {
play(0, 4, 5, 1);
}
if (s == "S") {
play(0, 1, 5, 4);
}
if (s == "W") {
play(0, 3, 5, 2);
}
}
void Dice::play(int a, int b, int c, int d) {
int temp;
temp = num[d];
num[d] = num[c];
num[c] = num[b];
num[b] = num[a];
num[a] = temp;
}
void Dice::to_top_and_front(int top, int front) {
string str[7] = {"N", "N", "N", "W", "N", "N", "N"};
for (int i = 0; i < 7; ++i) {
if (front == num[1])
break;
play_dice(str[i]);
}
while (top != num[0]) {
play_dice("W");
}
}
bool compare(Dice a, Dice b) {
a.to_top_and_front(b.num[0], b.num[1]);
for (int i = 0; i < COUNT; ++i) {
if (a.num[i] != b.num[i]) {
return false;
}
}
return true;
}
int main(int argc, char const *argv[]) {
Dice *cs;
int times;
cin >> times;
cs = new Dice[times];
for (int i = 0; i < times; ++i) {
for (int k = i + 1; k < times; ++k) {
if (compare(cs[i], cs[k])) {
delete[] cs;
printf("No\n");
return 0;
}
}
}
delete[] cs;
printf("Yes\n");
return 0;
}
|
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
const int COUNT = 6;
class Dice {
public:
int num[6];
public:
Dice();
void play_dice(string);
void play(int, int, int, int);
void print_(int x) { printf("%d\n", num[x]); }
void to_top_and_front(int, int);
};
Dice::Dice() {
for (int i = 0; i < COUNT; ++i) {
cin >> num[i];
}
}
void Dice::play_dice(string s) {
if (s == "E") {
play(0, 2, 5, 3);
}
if (s == "N") {
play(0, 4, 5, 1);
}
if (s == "S") {
play(0, 1, 5, 4);
}
if (s == "W") {
play(0, 3, 5, 2);
}
}
void Dice::play(int a, int b, int c, int d) {
int temp;
temp = num[d];
num[d] = num[c];
num[c] = num[b];
num[b] = num[a];
num[a] = temp;
}
void Dice::to_top_and_front(int top, int front) {
string str[7] = {"N", "N", "N", "W", "N", "N", "N"};
for (int i = 0; i < 7; ++i) {
if (front == num[1])
break;
play_dice(str[i]);
}
for (int k = 0; k < 4; k++) {
if (top == num[0])
break;
play_dice("W");
}
}
bool compare(Dice a, Dice b) {
a.to_top_and_front(b.num[0], b.num[1]);
for (int i = 0; i < COUNT; ++i) {
if (a.num[i] != b.num[i]) {
return false;
}
}
return true;
}
int main(int argc, char const *argv[]) {
Dice *cs;
int times;
cin >> times;
cs = new Dice[times];
for (int i = 0; i < times; ++i) {
for (int k = i + 1; k < times; ++k) {
if (compare(cs[i], cs[k])) {
delete[] cs;
printf("No\n");
return 0;
}
}
}
delete[] cs;
printf("Yes\n");
return 0;
}
|
replace
| 60 | 61 | 60 | 63 |
TLE
| |
p02386
|
C++
|
Runtime Error
|
#include <iostream>
#include <vector>
using namespace std;
class Dice {
public:
long r[6];
Dice(){};
void roll(long a, long b, long c, long d) {
swap(r[a], r[b]);
swap(r[b], r[c]);
swap(r[c], r[d]);
}
void spinW() { roll(0, 2, 5, 3); }
void spinN() { roll(0, 1, 5, 4); }
};
int main() {
int ans = 0;
int n;
cin >> n;
vector<Dice> D(n);
for (int i = 0; i < n; i++) {
for (int j = 0; j < 6; j++)
cin >> D[i].r[j];
}
for (int i = 0; i < n; i++) {
for (int j = i + 1; j <= n; j++) {
char SWS[8] = {"NNNWNNN"};
for (int k = 0; k < 8; k++) {
if (D[i].r[1] == D[j].r[1])
break;
if (SWS[k] == 'W')
D[j].spinW();
else
D[j].spinN();
}
for (int k = 0; k < 4; k++) {
if (D[i].r[0] == D[j].r[0]) {
if (D[i].r[1] == D[j].r[1] && D[i].r[2] == D[j].r[2] &&
D[i].r[3] == D[j].r[3] && D[i].r[4] == D[j].r[4] &&
D[i].r[5] == D[j].r[5])
ans++;
}
D[j].spinW();
}
}
}
if (ans == 0)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
|
#include <iostream>
#include <vector>
using namespace std;
class Dice {
public:
long r[6];
Dice(){};
void roll(long a, long b, long c, long d) {
swap(r[a], r[b]);
swap(r[b], r[c]);
swap(r[c], r[d]);
}
void spinW() { roll(0, 2, 5, 3); }
void spinN() { roll(0, 1, 5, 4); }
};
int main() {
int ans = 0;
int n;
cin >> n;
vector<Dice> D(n);
for (int i = 0; i < n; i++) {
for (int j = 0; j < 6; j++)
cin >> D[i].r[j];
}
for (int i = 0; i < n - 1; i++) {
for (int j = i + 1; j < n; j++) {
char SWS[8] = {"NNNWNNN"};
for (int k = 0; k < 8; k++) {
if (D[i].r[1] == D[j].r[1])
break;
if (SWS[k] == 'W')
D[j].spinW();
else
D[j].spinN();
}
for (int k = 0; k < 4; k++) {
if (D[i].r[0] == D[j].r[0]) {
if (D[i].r[1] == D[j].r[1] && D[i].r[2] == D[j].r[2] &&
D[i].r[3] == D[j].r[3] && D[i].r[4] == D[j].r[4] &&
D[i].r[5] == D[j].r[5])
ans++;
}
D[j].spinW();
}
}
}
if (ans == 0)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
|
replace
| 26 | 28 | 26 | 28 |
0
| |
p02386
|
C++
|
Time Limit Exceeded
|
#include <iostream>
using namespace std;
class Cube {
public:
int f[6];
Cube() {}
void roll_z() { roll(1, 2, 4, 3); }
void roll_y() { roll(0, 2, 5, 3); }
void roll_x() { roll(0, 1, 5, 4); }
void roll(int i, int j, int k, int l) {
int t = f[i];
f[i] = f[j];
f[j] = f[k];
f[k] = f[l];
f[l] = t;
}
};
bool eq(Cube c1, Cube c2) {
for (int i = 0; i < 6; i++) {
if (c1.f[i] != c2.f[i])
return false;
}
return true;
}
bool equal(Cube c1, Cube c2) {
for (int i = 0; i < 6; i++) {
for (int j = 0; j < 4; j++) {
if (eq(c1, c2))
return true;
c1.roll_z();
}
if (i % 2 == 0)
c1.roll_y();
else
c1.roll_x();
}
return false;
}
Cube C[100];
int n;
bool check() {
for (int i = 0; i < n - 1; i++) {
for (int j = i + 1; j < n; j++) {
if (equal(C[i], C[j]))
return false;
}
}
return true;
}
int main() {
cin >> n;
for (int j = 0; j < n; j++) {
for (int i = 0; i < 6; j++)
cin >> C[j].f[i];
}
if (check())
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
|
#include <iostream>
using namespace std;
class Cube {
public:
int f[6];
Cube() {}
void roll_z() { roll(1, 2, 4, 3); }
void roll_y() { roll(0, 2, 5, 3); }
void roll_x() { roll(0, 1, 5, 4); }
void roll(int i, int j, int k, int l) {
int t = f[i];
f[i] = f[j];
f[j] = f[k];
f[k] = f[l];
f[l] = t;
}
};
bool eq(Cube c1, Cube c2) {
for (int i = 0; i < 6; i++) {
if (c1.f[i] != c2.f[i])
return false;
}
return true;
}
bool equal(Cube c1, Cube c2) {
for (int i = 0; i < 6; i++) {
for (int j = 0; j < 4; j++) {
if (eq(c1, c2))
return true;
c1.roll_z();
}
if (i % 2 == 0)
c1.roll_y();
else
c1.roll_x();
}
return false;
}
Cube C[100];
int n;
bool check() {
for (int i = 0; i < n - 1; i++) {
for (int j = i + 1; j < n; j++) {
if (equal(C[i], C[j]))
return false;
}
}
return true;
}
int main() {
cin >> n;
for (int j = 0; j < n; j++) {
for (int i = 0; i < 6; i++)
cin >> C[j].f[i];
}
if (check())
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
|
replace
| 59 | 60 | 59 | 60 |
TLE
| |
p02386
|
C++
|
Time Limit Exceeded
|
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
void roll(std::vector<int> &v, char c) {
if (c == 'E') {
char tmp = v[0];
v[0] = v[3];
v[3] = v[5];
v[5] = v[2];
v[2] = tmp;
} else if (c == 'S') {
char tmp = v[0];
v[0] = v[4];
v[4] = v[5];
v[5] = v[1];
v[1] = tmp;
} else if (c == 'N') {
char tmp = v[0];
v[0] = v[1];
v[1] = v[5];
v[5] = v[4];
v[4] = tmp;
} else {
char tmp = v[0];
v[0] = v[2];
v[2] = v[5];
v[5] = v[3];
v[3] = tmp;
}
}
bool isSame(std::vector<int> v, std::vector<int> v2) {
if (v[1] != v2[1]) {
if (v2[4] == v[1])
roll(v2, 'N');
while (v2[0] != v[1])
roll(v2, 'E');
roll(v2, 'S');
}
for (int i = 0; i < 4; i++) {
if (v == v2) {
return true;
}
roll(v2, 'E');
}
return false;
}
int main() {
int n;
std::cin >> n;
std::vector<std::vector<int>> v(n, std::vector<int>(6));
for (int i = 0; i < n; i++) {
scanf("%d %d %d %d %d %d", &v[i][0], &v[i][1], &v[i][2], &v[i][3], &v[i][4],
&v[i][5]);
}
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
if (isSame(v[i], v[j])) {
std::cout << "No" << std::endl;
return 0;
}
}
}
std::cout << "Yes" << std::endl;
return 0;
}
|
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
void roll(std::vector<int> &v, char c) {
if (c == 'E') {
char tmp = v[0];
v[0] = v[3];
v[3] = v[5];
v[5] = v[2];
v[2] = tmp;
} else if (c == 'S') {
char tmp = v[0];
v[0] = v[4];
v[4] = v[5];
v[5] = v[1];
v[1] = tmp;
} else if (c == 'N') {
char tmp = v[0];
v[0] = v[1];
v[1] = v[5];
v[5] = v[4];
v[4] = tmp;
} else {
char tmp = v[0];
v[0] = v[2];
v[2] = v[5];
v[5] = v[3];
v[3] = tmp;
}
}
bool isSame(std::vector<int> v, std::vector<int> v2) {
std::vector<int> tmp, tmp2;
tmp = v;
tmp2 = v2;
std::sort(tmp.begin(), tmp.end());
std::sort(tmp2.begin(), tmp2.end());
if (tmp != tmp2)
return false;
if (v[1] != v2[1]) {
if (v2[4] == v[1])
roll(v2, 'N');
while (v2[0] != v[1])
roll(v2, 'E');
roll(v2, 'S');
}
for (int i = 0; i < 4; i++) {
if (v == v2) {
return true;
}
roll(v2, 'E');
}
return false;
}
int main() {
int n;
std::cin >> n;
std::vector<std::vector<int>> v(n, std::vector<int>(6));
for (int i = 0; i < n; i++) {
scanf("%d %d %d %d %d %d", &v[i][0], &v[i][1], &v[i][2], &v[i][3], &v[i][4],
&v[i][5]);
}
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
if (isSame(v[i], v[j])) {
std::cout << "No" << std::endl;
return 0;
}
}
}
std::cout << "Yes" << std::endl;
return 0;
}
|
insert
| 37 | 37 | 37 | 44 |
TLE
| |
p02386
|
C++
|
Time Limit Exceeded
|
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
/*
NumnerOfDice?????????????????????????????§????????????????????????(No)????????????????????°??????(Yes)???????????????CheckConsistentDice_N
?????????????????????????????°???????????§?????????????????????CheckConsistentLabel
?????????????????????????????????????????¢????????????????????????TopFront
*/
class DICE {
private:
int Label[6];
public:
DICE();
void Input();
void RotateDirection(std::string);
void Rotate(int, int, int, int);
int GetLabel(int x) { return Label[x]; }
void TopFront(int, int);
bool CheckConsistentLabel(DICE AnotherDice);
};
DICE::DICE() {}
void DICE::Input() {
for (int i = 0; i < 6; ++i) {
std::cin >> Label[i];
}
}
void DICE::RotateDirection(std::string s) {
if (s == "E") {
Rotate(0, 3, 5, 2);
}
if (s == "N") {
Rotate(0, 1, 5, 4);
}
if (s == "S") {
Rotate(0, 4, 5, 1);
}
if (s == "W") {
Rotate(0, 2, 5, 3);
}
}
void DICE::Rotate(int a, int b, int c, int d) {
std::swap(Label[a], Label[b]);
std::swap(Label[b], Label[c]);
std::swap(Label[c], Label[d]);
}
void DICE::TopFront(int top, int front) {
const int size_str = 7;
std::string str[size_str] = {"N", "N", "N", "W", "N", "N", "N"};
for (unsigned int i = 0; i < size_str; ++i) {
if (front == Label[1]) {
break;
}
RotateDirection(str[i]);
}
while (top != Label[0]) {
RotateDirection("W");
}
}
bool DICE::CheckConsistentLabel(DICE AnotherDice) {
int NumberLabel[101] = {0};
for (int i = 0; i < 6; ++i) {
NumberLabel[Label[i]] += 1;
NumberLabel[AnotherDice.GetLabel(i)] -= 1;
}
int i = 0;
while (i <= 100) {
if (NumberLabel[i] != 0) {
return false;
}
++i;
}
return true;
}
bool CheckConsistentDice_N(std::vector<DICE> &dice) {
const int LastNumberDice = 5;
for (unsigned int i = 0; i < dice.size(); ++i) {
for (unsigned int j = i + 1; j < dice.size(); ++j) {
if (dice[i].CheckConsistentLabel(dice[j])) {
dice[i].TopFront(dice[j].GetLabel(0), dice[j].GetLabel(1));
for (int k = 0; k <= LastNumberDice; ++k) {
if (dice[i].GetLabel(k) != dice[j].GetLabel(k)) {
break;
} else {
if (k == LastNumberDice) {
return false;
}
}
}
}
}
}
return true;
}
int main(void) {
int NumberOfDice;
std::cin >> NumberOfDice;
std::vector<DICE> dice(NumberOfDice);
for (int i = 0; i < dice.size(); i++) {
dice[i].Input();
}
if (CheckConsistentDice_N(dice)) {
std::cout << "Yes" << std::endl;
} else {
std::cout << "No" << std::endl;
}
// system("pause");
return 0;
}
|
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
/*
NumnerOfDice?????????????????????????????§????????????????????????(No)????????????????????°??????(Yes)???????????????CheckConsistentDice_N
?????????????????????????????°???????????§?????????????????????CheckConsistentLabel
?????????????????????????????????????????¢????????????????????????TopFront
*/
class DICE {
private:
int Label[6];
public:
DICE();
void Input();
void RotateDirection(std::string);
void Rotate(int, int, int, int);
int GetLabel(int x) { return Label[x]; }
void TopFront(int, int);
bool CheckConsistentLabel(DICE AnotherDice);
};
DICE::DICE() {}
void DICE::Input() {
for (int i = 0; i < 6; ++i) {
std::cin >> Label[i];
}
}
void DICE::RotateDirection(std::string s) {
if (s == "E") {
Rotate(0, 3, 5, 2);
}
if (s == "N") {
Rotate(0, 1, 5, 4);
}
if (s == "S") {
Rotate(0, 4, 5, 1);
}
if (s == "W") {
Rotate(0, 2, 5, 3);
}
}
void DICE::Rotate(int a, int b, int c, int d) {
std::swap(Label[a], Label[b]);
std::swap(Label[b], Label[c]);
std::swap(Label[c], Label[d]);
}
void DICE::TopFront(int top, int front) {
const int size_str = 7;
std::string str[size_str] = {"N", "N", "N", "W", "N", "N", "N"};
for (unsigned int i = 0; i < size_str; ++i) {
if (front == Label[1]) {
break;
}
RotateDirection(str[i]);
}
{
for (unsigned int i = 0; i < 4; ++i) {
if (top == Label[0])
break;
RotateDirection("W");
}
}
}
bool DICE::CheckConsistentLabel(DICE AnotherDice) {
int NumberLabel[101] = {0};
for (int i = 0; i < 6; ++i) {
NumberLabel[Label[i]] += 1;
NumberLabel[AnotherDice.GetLabel(i)] -= 1;
}
int i = 0;
while (i <= 100) {
if (NumberLabel[i] != 0) {
return false;
}
++i;
}
return true;
}
bool CheckConsistentDice_N(std::vector<DICE> &dice) {
const int LastNumberDice = 5;
for (unsigned int i = 0; i < dice.size(); ++i) {
for (unsigned int j = i + 1; j < dice.size(); ++j) {
if (dice[i].CheckConsistentLabel(dice[j])) {
dice[i].TopFront(dice[j].GetLabel(0), dice[j].GetLabel(1));
for (int k = 0; k <= LastNumberDice; ++k) {
if (dice[i].GetLabel(k) != dice[j].GetLabel(k)) {
break;
} else {
if (k == LastNumberDice) {
return false;
}
}
}
}
}
}
return true;
}
int main(void) {
int NumberOfDice;
std::cin >> NumberOfDice;
std::vector<DICE> dice(NumberOfDice);
for (int i = 0; i < dice.size(); i++) {
dice[i].Input();
}
if (CheckConsistentDice_N(dice)) {
std::cout << "Yes" << std::endl;
} else {
std::cout << "No" << std::endl;
}
// system("pause");
return 0;
}
|
replace
| 56 | 58 | 56 | 63 |
TLE
| |
p02386
|
C++
|
Runtime Error
|
#include <array>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
constexpr int SURFACE_NUM = 6;
enum { TOP, FRONT, RIGHT, LEFT, BACK, BOTTOM };
class Dice {
private:
array<int, SURFACE_NUM> m_surface;
public:
// constructor
Dice(array<int, SURFACE_NUM> surface) : m_surface(surface) {}
// getter
int surface(int i) const { return m_surface.at(i); }
// roll and spin
void roll(char direction) {
switch (direction) {
case 'N':
roll(TOP, FRONT, BOTTOM, BACK);
break;
case 'S':
roll(TOP, BACK, BOTTOM, FRONT);
break;
case 'E':
roll(TOP, LEFT, BOTTOM, RIGHT);
break;
case 'W':
roll(TOP, RIGHT, BOTTOM, LEFT);
break;
}
}
void roll(int i, int j, int k, int l) {
int tmp = m_surface.at(i);
m_surface.at(i) = m_surface.at(j);
m_surface.at(j) = m_surface.at(k);
m_surface.at(k) = m_surface.at(l);
m_surface.at(l) = tmp;
}
void spin() {
int tmp = m_surface.at(FRONT);
m_surface.at(FRONT) = m_surface.at(LEFT);
m_surface.at(LEFT) = m_surface.at(BACK);
m_surface.at(BACK) = m_surface.at(RIGHT);
m_surface.at(RIGHT) = tmp;
}
// is equal
bool isEqual(const Dice &dice) {
for (int i = 0; i < 6; i++) {
(i % 2) ? (*this).roll('E') : (*this).roll('N');
for (int j = 0; j < 4; j++) {
(*this).spin();
if (*this == dice) {
return true;
}
}
}
return false;
}
bool operator==(const Dice &dice) {
for (int i = 0; i < SURFACE_NUM; i++) {
if (m_surface.at(i) != dice.surface(i)) {
return false;
}
}
return true;
}
// debug
void printDice() const {
cout << surface(TOP) << surface(FRONT) << surface(RIGHT) << surface(LEFT)
<< surface(BACK) << surface(BOTTOM) << endl;
}
};
array<int, SURFACE_NUM> inputDice();
int main() {
int dice_num;
cin >> dice_num;
vector<Dice> dices;
dices.reserve(dice_num);
for (auto i = 0; i < dice_num; i++) {
Dice dice(inputDice());
dices.at(i) = dice;
}
bool is_diff_all = true;
for (int i = 0; i < dice_num - 1 && is_diff_all; i++) {
for (int j = i + 1; j < dice_num; j++) {
if (dices.at(i).isEqual(dices.at(j))) {
is_diff_all = false;
break;
}
}
}
cout << (is_diff_all ? "Yes" : "No") << endl;
}
array<int, SURFACE_NUM> inputDice() {
array<int, SURFACE_NUM> init;
for (auto i = 0; i < SURFACE_NUM; i++) {
cin >> init.at(i);
}
return init;
}
|
#include <array>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
constexpr int SURFACE_NUM = 6;
enum { TOP, FRONT, RIGHT, LEFT, BACK, BOTTOM };
class Dice {
private:
array<int, SURFACE_NUM> m_surface;
public:
// constructor
Dice(array<int, SURFACE_NUM> surface) : m_surface(surface) {}
// getter
int surface(int i) const { return m_surface.at(i); }
// roll and spin
void roll(char direction) {
switch (direction) {
case 'N':
roll(TOP, FRONT, BOTTOM, BACK);
break;
case 'S':
roll(TOP, BACK, BOTTOM, FRONT);
break;
case 'E':
roll(TOP, LEFT, BOTTOM, RIGHT);
break;
case 'W':
roll(TOP, RIGHT, BOTTOM, LEFT);
break;
}
}
void roll(int i, int j, int k, int l) {
int tmp = m_surface.at(i);
m_surface.at(i) = m_surface.at(j);
m_surface.at(j) = m_surface.at(k);
m_surface.at(k) = m_surface.at(l);
m_surface.at(l) = tmp;
}
void spin() {
int tmp = m_surface.at(FRONT);
m_surface.at(FRONT) = m_surface.at(LEFT);
m_surface.at(LEFT) = m_surface.at(BACK);
m_surface.at(BACK) = m_surface.at(RIGHT);
m_surface.at(RIGHT) = tmp;
}
// is equal
bool isEqual(const Dice &dice) {
for (int i = 0; i < 6; i++) {
(i % 2) ? (*this).roll('E') : (*this).roll('N');
for (int j = 0; j < 4; j++) {
(*this).spin();
if (*this == dice) {
return true;
}
}
}
return false;
}
bool operator==(const Dice &dice) {
for (int i = 0; i < SURFACE_NUM; i++) {
if (m_surface.at(i) != dice.surface(i)) {
return false;
}
}
return true;
}
// debug
void printDice() const {
cout << surface(TOP) << surface(FRONT) << surface(RIGHT) << surface(LEFT)
<< surface(BACK) << surface(BOTTOM) << endl;
}
};
array<int, SURFACE_NUM> inputDice();
int main() {
int dice_num;
cin >> dice_num;
vector<Dice> dices;
dices.reserve(dice_num);
for (auto i = 0; i < dice_num; i++) {
Dice dice(inputDice());
dices.push_back(dice);
}
bool is_diff_all = true;
for (int i = 0; i < dice_num - 1 && is_diff_all; i++) {
for (int j = i + 1; j < dice_num; j++) {
if (dices.at(i).isEqual(dices.at(j))) {
is_diff_all = false;
break;
}
}
}
cout << (is_diff_all ? "Yes" : "No") << endl;
}
array<int, SURFACE_NUM> inputDice() {
array<int, SURFACE_NUM> init;
for (auto i = 0; i < SURFACE_NUM; i++) {
cin >> init.at(i);
}
return init;
}
|
replace
| 95 | 96 | 95 | 96 |
-6
|
terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check: __n (which is 0) >= this->size() (which is 0)
|
p02388
|
Python
|
Runtime Error
|
x = input()
print(x**3)
|
x = input()
x = int(x)
print(x**3)
|
insert
| 1 | 1 | 1 | 2 |
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s725747490.py", line 2, in <module>
print(x**3)
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
p02388
|
Python
|
Runtime Error
|
x = input()
print(x**3)
|
x = int(input())
print(x**3)
|
replace
| 0 | 1 | 0 | 1 |
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s709080194.py", line 2, in <module>
print(x**3)
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
p02388
|
Python
|
Runtime Error
|
n = input()
print(n * n * n)
|
s = input()
n = int(s)
print(n**3)
|
replace
| 0 | 2 | 0 | 3 |
TypeError: can't multiply sequence by non-int of type 'str'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s234463127.py", line 2, in <module>
print(n * n * n)
TypeError: can't multiply sequence by non-int of type 'str'
|
p02388
|
Python
|
Runtime Error
|
x = input()
print(x**3)
|
x = input()
x = int(x)
print(x**3)
|
insert
| 1 | 1 | 1 | 2 |
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s056318749.py", line 3, in <module>
print(x**3)
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
p02388
|
Python
|
Runtime Error
|
num = input()
print(num**3)
|
num_str = input()
num = int(num_str)
print(num**3)
|
replace
| 0 | 2 | 0 | 2 |
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s367615831.py", line 3, in <module>
print(num ** 3)
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
p02388
|
Python
|
Runtime Error
|
print(input() ** 3)
|
i = int(input())
print(i**3)
|
replace
| 0 | 1 | 0 | 2 |
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s667447252.py", line 1, in <module>
print(input()**3)
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
p02388
|
Python
|
Runtime Error
|
input = input()
print(input**3)
|
input = input()
print(int(input) ** 3)
|
replace
| 1 | 2 | 1 | 2 |
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s516531505.py", line 2, in <module>
print(input**3)
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
p02388
|
Python
|
Runtime Error
|
print(input() ** 3)
|
print(int(input()) ** 3)
|
replace
| 0 | 1 | 0 | 1 |
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s557766359.py", line 1, in <module>
print(input()**3)
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
p02388
|
Python
|
Runtime Error
|
x = input()
print(x**3)
|
x = int(input())
print(x**3)
|
replace
| 0 | 1 | 0 | 1 |
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s482874964.py", line 3, in <module>
print(x**3)
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
p02388
|
Python
|
Runtime Error
|
print(input() ** 3)
|
print(int(input()) ** 3)
|
replace
| 0 | 1 | 0 | 1 |
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s627402686.py", line 1, in <module>
print(input() ** 3)
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
p02388
|
Python
|
Runtime Error
|
N = input()
print(N**3)
|
N = int(input())
print(N**3)
|
replace
| 0 | 1 | 0 | 1 |
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s645472377.py", line 2, in <module>
print(N**3)
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
p02388
|
Python
|
Runtime Error
|
x = input()
ans = x * x * x
print(ans)
|
x = int(input())
ans = x * x * x
print(ans)
|
replace
| 0 | 1 | 0 | 1 |
TypeError: can't multiply sequence by non-int of type 'str'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s517488440.py", line 3, in <module>
ans = x * x * x
TypeError: can't multiply sequence by non-int of type 'str'
|
p02388
|
C++
|
Runtime Error
|
#include <stdio.h>
int main(void) {
int x;
scanf("%d", x);
printf("%d \n", x * x * x);
return 0;
}
|
#include <stdio.h>
int main(void) {
int x, xxx;
scanf("%d", &x);
xxx = x * x * x;
printf("%d\n", xxx);
return 0;
}
|
replace
| 3 | 6 | 3 | 7 |
-11
| |
p02388
|
C++
|
Time Limit Exceeded
|
#include <iostream>
using namespace std;
int main() {
int x, sum;
do {
cin >> x;
} while (x < 1 || x > 10);
sum = x * x * x;
cout << sum << endl;
return 0;
}
|
#include <iostream>
using namespace std;
int main() {
int x, sum;
cin >> x;
sum = x * x * x;
cout << sum << endl;
return 0;
}
|
replace
| 6 | 9 | 6 | 9 |
TLE
| |
p02388
|
C++
|
Runtime Error
|
#include <stdio.h>
int main(void) {
int x = 0;
scanf("%d", x);
printf("%d", x * x * x);
return 0;
}
|
#include <stdio.h>
int main(void) {
int x = 0;
scanf("%d", &x);
printf("%d\n", x * x * x);
return 0;
}
|
replace
| 3 | 5 | 3 | 5 |
-11
| |
p02388
|
C++
|
Runtime Error
|
#include <stdio.h>
int main() {
int a;
scanf("%d", a);
printf("%d\n", a * a * a);
return 0;
}
|
#include <stdio.h>
int main() {
int a;
scanf("%d", &a);
printf("%d\n", a * a * a);
return 0;
}
|
replace
| 3 | 4 | 3 | 4 |
-11
| |
p02388
|
C++
|
Time Limit Exceeded
|
#include <iostream>
using namespace std;
int Cubic(int x) { return (x * x * x); }
int main() {
int x;
cin >> x;
x = Cubic(x);
cout << x << endl;
while (1)
;
return 0;
}
|
#include <iostream>
using namespace std;
int Cubic(int x) { return (x * x * x); }
int main() {
int x;
cin >> x;
x = Cubic(x);
cout << x << endl;
// while(1);
return 0;
}
|
replace
| 15 | 17 | 15 | 16 |
TLE
| |
p02388
|
C++
|
Runtime Error
|
#include <stdio.h>
int main() {
int x;
scanf("%d", x);
printf("%d\n", x * x * x);
}
|
#include <stdio.h>
int main() {
int x;
scanf("%d", &x);
printf("%d\n", x * x * x);
}
|
replace
| 3 | 4 | 3 | 4 |
-11
| |
p02388
|
C++
|
Runtime Error
|
#include <stdio.h>
int main(void) {
int a;
scanf("%d", &a);
int b = a * a * a;
return (b);
}
|
#include <stdio.h>
int main(void) {
int a;
scanf("%d", &a);
int b = a * a * a;
printf("%d\n", b);
return (0);
}
|
replace
| 6 | 7 | 6 | 8 |
8
| |
p02388
|
C++
|
Runtime Error
|
#include <iostream>
int main() {
int x;
std::cin >> x;
std::cout << x * x * x << std::endl;
return x;
}
|
#include <iostream>
int main() {
int x;
std::cin >> x;
std::cout << x * x * x << std::endl;
}
|
delete
| 6 | 7 | 6 | 6 |
2
| |
p02388
|
Python
|
Runtime Error
|
x = input()
print(x**3)
|
x = int(input())
print(x**3)
|
replace
| 0 | 1 | 0 | 1 |
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s996581497.py", line 2, in <module>
print(x**3)
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
p02388
|
Python
|
Runtime Error
|
x = input(())
print(x**3)
|
x = int(input())
print(x**3)
|
replace
| 0 | 1 | 0 | 1 |
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s164445315.py", line 4, in <module>
print(x**3)
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
p02388
|
Python
|
Runtime Error
|
print(int(input) ** 3)
|
print(int(input()) ** 3)
|
replace
| 0 | 1 | 0 | 1 |
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'builtin_function_or_method'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s322584303.py", line 1, in <module>
print(int(input)**3)
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'builtin_function_or_method'
|
p02388
|
Python
|
Runtime Error
|
import sys
args = sys.argv
num = int(args[1])
print(str(num**3))
|
s = input()
num = int(s)
print(str(num**3))
|
replace
| 0 | 5 | 0 | 2 |
IndexError: list index out of range
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s550015206.py", line 5, in <module>
num = int(args[1])
IndexError: list index out of range
|
p02388
|
Python
|
Runtime Error
|
print(input() ** 3)
|
print(int(input()) ** 3)
|
replace
| 0 | 1 | 0 | 1 |
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s376152712.py", line 1, in <module>
print(input() ** 3)
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
p02388
|
Python
|
Runtime Error
|
x = input()
print(x * x * x)
|
x = int(input())
print(x * x * x)
|
replace
| 0 | 2 | 0 | 1 |
TypeError: can't multiply sequence by non-int of type 'str'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s272745096.py", line 3, in <module>
print(x * x * x)
TypeError: can't multiply sequence by non-int of type 'str'
|
p02388
|
Python
|
Runtime Error
|
x = input()
print(x**3)
|
input_1 = int(input())
cal = (input_1) ** 3
print(cal)
|
replace
| 0 | 2 | 0 | 3 |
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s257611309.py", line 2, in <module>
print(x**3)
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
p02388
|
Python
|
Runtime Error
|
x = input()
y = x**3
print(y)
|
x = input()
print(x**3)
|
replace
| 1 | 3 | 1 | 2 |
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s666518215.py", line 3, in <module>
y = x ** 3
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
p02388
|
Python
|
Runtime Error
|
print(input() ** 3)
|
print(int(input()) ** 3)
|
replace
| 0 | 1 | 0 | 1 |
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s844443016.py", line 1, in <module>
print(input()**3)
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
p02388
|
Python
|
Runtime Error
|
x = int(input())
print(**3)
|
x = int(input())
print(x**3)
|
replace
| 1 | 2 | 1 | 2 |
TypeError: print() argument after ** must be a mapping, not int
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s451360688.py", line 2, in <module>
print(**3)
TypeError: print() argument after ** must be a mapping, not int
|
p02388
|
Python
|
Runtime Error
|
print(int(input) ** 3)
|
print(int(input()) ** 3)
|
replace
| 0 | 1 | 0 | 1 |
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'builtin_function_or_method'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s844330584.py", line 1, in <module>
print(int(input)**3)
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'builtin_function_or_method'
|
p02388
|
Python
|
Runtime Error
|
print(int(input) ** 3)
|
print(int(input()) ** 3)
|
replace
| 0 | 1 | 0 | 1 |
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'builtin_function_or_method'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s120361537.py", line 1, in <module>
print(int(input)**3)
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'builtin_function_or_method'
|
p02388
|
Python
|
Runtime Error
|
s = input("")
ans = s * s * s
print(ans)
|
user = input("")
num = int(user)
ans = num * num * num
print(ans)
|
replace
| 0 | 2 | 0 | 3 |
TypeError: can't multiply sequence by non-int of type 'str'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s469089457.py", line 2, in <module>
ans = s * s * s
TypeError: can't multiply sequence by non-int of type 'str'
|
p02388
|
C++
|
Runtime Error
|
#include <stdio.h>
int main(void) {
int x;
scanf("%d", x);
printf("%d", x * 2);
return 0;
}
|
#include <stdio.h>
int main(void) {
int x;
scanf("%d", &x);
x = x * x * x;
printf("%d\n", x);
return 0;
}
|
replace
| 4 | 6 | 4 | 7 |
-11
| |
p02388
|
C++
|
Runtime Error
|
#include <stdio.h>
int main(int argc, char *argv[]) {
int x = scanf("%d", argv[1]);
printf("%d\n", x * x * x);
return 0;
}
|
#include <stdio.h>
int main(int argc, char *argv[]) {
int x;
scanf("%d", &x);
printf("%d\n", x * x * x);
return 0;
}
|
replace
| 2 | 3 | 2 | 4 |
-11
| |
p02388
|
C++
|
Runtime Error
|
#include <iostream>
using namespace std;
int main() {
int x;
cin >> x;
return x * x * x;
}
|
#include <iostream>
using namespace std;
int main() {
int x;
cin >> x;
cout << x * x * x << endl;
return 0;
}
|
replace
| 6 | 7 | 6 | 8 |
8
| |
p02388
|
C++
|
Runtime Error
|
#include <stdio.h>
int main() {
int a;
scanf("%d", a);
printf("%d", a * a * a);
}
|
#include <stdio.h>
int main() {
int a, b;
scanf("%d", &a);
b = a * a * a;
printf("%d\n", b);
}
|
replace
| 2 | 5 | 2 | 6 |
-11
| |
p02388
|
C++
|
Runtime Error
|
#include <stdio.h>
int main(void) {
int x;
scanf("%d", &x);
return x * x * x;
}
|
#include <stdio.h>
int main(void) {
int x;
scanf("%d", &x);
printf("%d\n", x * x * x);
}
|
replace
| 5 | 6 | 5 | 6 |
8
| |
p02388
|
C++
|
Runtime Error
|
#include <stdio.h>
int main() {
int x;
scanf("%d", x);
x = x * x * x;
printf("%d\n", x);
}
|
#include <stdio.h>
int main() {
int x;
scanf("%d", &x);
x = x * x * x;
printf("%d\n", x);
}
|
replace
| 6 | 7 | 6 | 7 |
-11
| |
p02388
|
C++
|
Runtime Error
|
#include <iostream>
using namespace std;
int main(int x) { return x * x * x; }
|
#include <iostream>
using namespace std;
int main() {
int x;
cin >> x;
cout << x * x * x << endl;
}
|
replace
| 3 | 4 | 3 | 8 |
1
| |
p02388
|
C++
|
Runtime Error
|
#include <stdio.h>
int main(void) {
int x;
scanf("%d", x);
printf("%d", x * x * x);
return 0;
}
|
#include <stdio.h>
int main(void) {
int x;
scanf("%d", &x);
printf("%d\n", x * x * x);
return 0;
}
|
replace
| 5 | 7 | 5 | 7 |
-11
| |
p02388
|
C++
|
Runtime Error
|
#include <stdio.h>
int main(void) {
int x = 0;
scanf("%d\n", x);
printf("x", x * x * x);
return 0;
}
|
#include <stdio.h>
int main(void) {
int a;
scanf("%d\n", &a);
printf("%d\n", a * a * a);
return 0;
}
|
replace
| 3 | 6 | 3 | 6 |
-11
| |
p02388
|
Python
|
Runtime Error
|
number = input(int())
print(number**3)
|
number = int(input())
print(number**3)
|
replace
| 0 | 1 | 0 | 1 |
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s272552751.py", line 2, in <module>
print(number**3)
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
p02388
|
Python
|
Runtime Error
|
print(int(input() ** 3))
|
print(int(input()) ** 3)
|
replace
| 0 | 1 | 0 | 1 |
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s690364339.py", line 1, in <module>
print(int(input()**3))
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
p02388
|
C++
|
Runtime Error
|
#include <stdio.h>
int main() {
int x;
scanf("%d", x);
printf("%d", x * x * x);
return 0;
}
|
#include <stdio.h>
int main() {
int x;
scanf("%d", &x);
x = x * x * x;
printf("%d\n", x);
return 0;
}
|
replace
| 4 | 6 | 4 | 9 |
-11
| |
p02388
|
C++
|
Runtime Error
|
#include <iostream>
#define OK 1;
using namespace std;
int main(void) {
int x;
// scanf
cin >> x;
// printf
cout << x * x * x << endl;
return OK;
}
|
#include <iostream>
#define OK 0;
using namespace std;
int main(void) {
int x;
// scanf
cin >> x;
// printf
cout << x * x * x << endl;
return OK;
}
|
replace
| 2 | 3 | 2 | 3 |
1
| |
p02388
|
C++
|
Time Limit Exceeded
|
#include <iostream>
using namespace std;
int main(void) {
int x = 5;
int sum = 1;
do {
cin >> x;
} while (1 <= x && x <= 1000);
for (int i = 0; i <= 2; i++) {
sum *= x;
}
cout << sum << endl;
return 0;
}
|
#include <iostream>
using namespace std;
int main(void) {
int x = 5;
int sum = 1;
cin >> x;
for (int i = 0; i <= 2; i++) {
sum *= x;
}
cout << sum << endl;
return 0;
}
|
replace
| 7 | 10 | 7 | 8 |
TLE
| |
p02388
|
C++
|
Runtime Error
|
#include <stdio.h>
int main() {
int x, ans;
scanf("%d", x);
ans = x * x * x;
printf("%d\n", ans);
return 0;
}
|
#include <stdio.h>
int main() {
int x, ans;
scanf("%d", &x);
ans = x * x * x;
printf("%d\n", ans);
return 0;
}
|
replace
| 4 | 5 | 4 | 5 |
-11
| |
p02388
|
C++
|
Time Limit Exceeded
|
#include <iostream>
using namespace std;
int main() {
int x;
do {
cin >> x;
} while (x >= 1 && x <= 100);
cout << (x * x * x) << endl;
return 0;
}
|
#include <iostream>
using namespace std;
int main() {
int x;
cin >> x;
cout << x * x * x << endl;
}
|
replace
| 5 | 10 | 5 | 7 |
TLE
| |
p02388
|
C++
|
Runtime Error
|
#include <stdio.h>
int main() {
int x, ans = 0;
scanf("%d", x);
ans = x * x * x;
printf("%d\n", ans);
return 0;
}
|
#include <stdio.h>
int main() {
int x, ans = 0;
scanf("%d", &x);
ans = x * x * x;
printf("%d\n", ans);
return 0;
}
|
replace
| 3 | 4 | 3 | 4 |
-11
| |
p02388
|
C++
|
Runtime Error
|
#include <stdio.h>
int main() {
int x = 0;
scanf("%d", x);
printf("%d\n", x * x * x);
return 0;
}
|
#include <stdio.h>
int main() {
int x = 0;
scanf("%d", &x);
printf("%d\n", x * x * x);
return 0;
}
|
replace
| 4 | 5 | 4 | 5 |
-11
| |
p02388
|
C++
|
Runtime Error
|
#include <stdio.h>
int main() {
int x = 0;
scanf("%d", x);
printf("%d\n", &x);
return 0;
}
|
#include <stdio.h>
int main() {
int x = 0;
scanf("%d", &x);
printf("%d\n", x * x * x);
return 0;
}
|
replace
| 3 | 5 | 3 | 5 |
-11
| |
p02388
|
C++
|
Runtime Error
|
#include <stdio.h>
using namespace std;
int main() {
int w = 0;
scanf("%d", &w);
printf("%d\n", w * w * w);
return 8;
}
|
#include <stdio.h>
using namespace std;
int main() {
int w = 0;
scanf("%d", &w);
printf("%d\n", w * w * w);
return 0;
}
|
replace
| 6 | 7 | 6 | 7 |
8
| |
p02388
|
C++
|
Runtime Error
|
#include <iostream>
#include <string>
int main(int argc, char const *argv[]) {
std::string str;
int i, answer;
str += argv[1];
i = std::stoi(str);
answer = i * i * i;
std::cout << answer << std::endl;
return 0;
}
|
#include <iostream>
using namespace std;
int main() {
int x;
cin >> x;
cout << x * x * x << endl;
}
|
replace
| 1 | 10 | 1 | 7 |
-11
| |
p02388
|
Python
|
Runtime Error
|
x = input()
print(x**3)
|
x = int(input())
print(x**3)
|
replace
| 0 | 1 | 0 | 1 |
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02388/Python/s314503322.py", line 2, in <module>
print(x**3)
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
|
p02388
|
C++
|
Runtime Error
|
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
double charToDouble(char *c) { return atof(c); }
std::string doubleToString(double x) {
char c[256] = {'\0'};
sprintf(c, "%.0f", x);
return c;
}
int main(int argc, char *argv[]) {
double y = pow(charToDouble(argv[1]), 3);
std::cout << doubleToString(y) << std::endl;
}
|
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
double charToDouble(char *c) { return atof(c); }
std::string doubleToString(double x) {
char c[256] = {'\0'};
sprintf(c, "%.0f", x);
return c;
}
int main() {
int x;
std::cin >> x;
double y = pow(double(x), 3);
std::cout << doubleToString(y) << std::endl;
}
|
replace
| 15 | 17 | 15 | 19 |
-11
| |
p02388
|
C++
|
Runtime Error
|
#include <cstdio>
int main() {
int a, b;
scanf("%d", a);
b = a * a * a;
printf("%d\n", b);
return 0;
}
|
#include <cstdio>
int main() {
int a, b;
scanf("%d", &a);
b = a * a * a;
printf("%d\n", b);
return 0;
}
|
replace
| 3 | 4 | 3 | 4 |
-11
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.