Submission #51362

# Submission time Handle Problem Language Result Execution time Memory
51362 2018-06-17T16:05:40 Z KieranHorgan CATS (NOI14_cats) C++17
0 / 25
1500 ms 329696 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(10, 0);
    int s2 = 0;
    int xo = 0, x;
    while(counter) {
      if(s1.empty()) s1.push_back(0);
      s2 = s1.back();
      s1.pop_back();
      if(s2 > L) {
        counter--;
      } else {
        s2 += N*2;
        s1.push_back(s2^1);
        s1.push_back(s2);
      }
    }
    cout << s2 << endl;
  }
}

Compilation message

cats.cpp: In function 'int main()':
cats.cpp:28:9: warning: unused variable 'xo' [-Wunused-variable]
     int xo = 0, x;
         ^~
cats.cpp:28:17: warning: unused variable 'x' [-Wunused-variable]
     int xo = 0, x;
                 ^
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 117 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1109 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1578 ms 5152 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 536 ms 329448 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 479 ms 329696 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -