Submission #51342

# Submission time Handle Problem Language Result Execution time Memory
51342 2018-06-17T14:16:39 Z KieranHorgan CATS (NOI14_cats) C++17
4 / 25
1500 ms 63388 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(1000000, 0), s2(1000000, 0);
    int xo = 0, x;
    while(counter) {
      s2.push_back(s1.back() ^ xo);
      s1.pop_back();
      xo ^= 1;
      if(s2.back() > L) {
        counter--;
      } else {
        s2.push_back(N);
        s2.push_back(N);
        x = s2.back(); s2.pop_back(); s2.back() += x;
        x = s2.back(); s2.pop_back(); s2.back() += x;
        s1.push_back(s2.back()^xo);
        s1.push_back(s2.back()^xo);
        s2.pop_back();
        s2.pop_back();
      }
    }
    cout << s2.back() << endl;
  }
}
# Verdict Execution time Memory Grader output
1 Correct 41 ms 23800 KB Output is correct
2 Correct 34 ms 24036 KB Output is correct
3 Correct 38 ms 24116 KB Output is correct
4 Correct 33 ms 24116 KB Output is correct
5 Correct 34 ms 24116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1566 ms 35460 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1568 ms 35460 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1564 ms 35460 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 82 ms 47784 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 93 ms 63388 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -