Submission #51363

# Submission time Handle Problem Language Result Execution time Memory
51363 2018-06-17T16:07:18 Z KieranHorgan CATS (NOI14_cats) C++17
12 / 25
1500 ms 263976 KB
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
 
using namespace std;
#define endl '\n'
#define ll long long
#define int long long
#define ld long double
#define pii pair<int,int>
#define rand() abs((rand()<<15)|rand())
#define randll() abs(((long long)rand()<<30)|rand())
 
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long seed;
  asm("rdtsc" : "=A"(seed));
  srand(seed);
 
  int q;
  cin >> q;
  while(q--) {
    int X, L, N;
    cin >> X >> L >> N;
    int counter = X;
    vector<int> s1;
    int s2 = 0;
    int x = 0;
    while(counter) {
      if(s1.empty()) s1.push_back(0);
      s2 = s1.back()^x;
      x^=1;
      s1.pop_back();
      if(s2 > L) {
        counter--;
      } else {
        s2 += N*2;
        s1.push_back(s2^x);
        s1.push_back(s2^x);
      }
    }
    cout << s2 << endl;
  }
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 7 ms 488 KB Output is correct
3 Correct 5 ms 488 KB Output is correct
4 Correct 4 ms 488 KB Output is correct
5 Correct 6 ms 488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 132 ms 652 KB Output is correct
2 Correct 133 ms 696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1107 ms 696 KB Output is correct
2 Correct 1258 ms 696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1567 ms 4928 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 380 ms 263976 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 415 ms 263976 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -