// time_limit/2n_slow.cpp
#include "transfer.h"
#include <iostream>
using namespace std;
//Author: Kian Mirjalali
//K = 2*N
typedef vector<int> VI;
static inline int callLimit(int N) {
switch (N) {
case 63: return 20000;
case 255: return 200000;
}
cerr << "invalid value of N: " << N << endl;
exit(1);
}
static inline void burnCpu(int steps) {
int temp = 0;
for (int i=0; i<steps; i++)
if (i*i+i == temp)
temp++;
if (temp == -1)
cerr << "impossible" << endl;
}
VI get_attachment(VI source) {
const int N = source.size();
static int callCount = 0;
if (++callCount > callLimit(N)) {
cerr << "too many calls of get_attachment() : " << callCount << endl;
exit(1);
}
VI attachment = source;
attachment.insert(attachment.end(), source.begin(), source.end());
burnCpu(N*N);
return attachment;
}
VI retrieve(VI data) {
const int N = data.size()/3;
static int callCount = 0;
if (++callCount > callLimit(N)) {
cerr << "too many calls of retrieve() : " << callCount << endl;
exit(1);
}
VI result(N, 0);
for (int i=0; i<N; i++)
if (data[i]+data[N+i]+data[2*N+i] > 1)
result[i] = 1;
burnCpu(N*N);
return result;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
100 ms |
1032 KB |
Partially correct |
2 |
Partially correct |
100 ms |
1224 KB |
Partially correct |
3 |
Partially correct |
102 ms |
1024 KB |
Partially correct |
4 |
Partially correct |
101 ms |
1160 KB |
Partially correct |
5 |
Partially correct |
101 ms |
1180 KB |
Partially correct |
6 |
Partially correct |
101 ms |
1152 KB |
Partially correct |
7 |
Partially correct |
101 ms |
1176 KB |
Partially correct |
8 |
Partially correct |
100 ms |
1036 KB |
Partially correct |
9 |
Partially correct |
101 ms |
1160 KB |
Partially correct |
10 |
Partially correct |
100 ms |
1160 KB |
Partially correct |
11 |
Partially correct |
101 ms |
1096 KB |
Partially correct |
12 |
Partially correct |
102 ms |
1024 KB |
Partially correct |
13 |
Partially correct |
101 ms |
1196 KB |
Partially correct |
14 |
Partially correct |
101 ms |
1228 KB |
Partially correct |
15 |
Partially correct |
101 ms |
1280 KB |
Partially correct |
16 |
Partially correct |
101 ms |
1160 KB |
Partially correct |
17 |
Partially correct |
101 ms |
1068 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3070 ms |
5000 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |