# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
124637 |
2019-07-03T15:57:11 Z |
johutha |
CATS (NOI14_cats) |
C++14 |
|
1500 ms |
262148 KB |
#include <vector>
#include <iostream>
#define int int64_t
using namespace std;
struct solver
{
int x, l, n;
vector<int> s1;
vector<int> s2;
void calc()
{
s1.resize(2, 0);
s2.resize(2, 0);
int ctr = 0;
while (x > 0)
{
if (s1.size() == 0) {s1.push_back(0);}
s2.push_back(s1.back() ^ ctr);
s1.pop_back();
ctr += 1; ctr %= 2;
if (s2.back() > l)
{
x--;
if (x == 0) cout << s2.back() << "\n";
}
else
{
if (s2.size() == 0) s2.push_back(0);
s2.back() += 2*n;
s1.push_back(s2.back() ^ ctr);
s1.push_back(s2.back() ^ ctr);
if (s2.size() != 0) s2.pop_back();
if (s2.size() != 0) s2.pop_back();
}
}
}
};
signed main()
{
//ios_base::sync_with_stdio(0);
//cin.tie(0);
int q;
cin >> q;
for (int c = 0; c < q; c++)
{
solver s;
cin >> s.x >> s.l >> s.n;
s.calc();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
760 KB |
Output is correct |
2 |
Correct |
19 ms |
4584 KB |
Output is correct |
3 |
Correct |
15 ms |
2540 KB |
Output is correct |
4 |
Correct |
12 ms |
1520 KB |
Output is correct |
5 |
Correct |
16 ms |
4580 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
623 ms |
7960 KB |
Output is correct |
2 |
Correct |
523 ms |
8420 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1547 ms |
7560 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1557 ms |
4632 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
632 ms |
262148 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
632 ms |
262148 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |