Submission #90603

# Submission time Handle Problem Language Result Execution time Memory
90603 2018-12-22T20:28:33 Z Milki Nizovi (COI14_nizovi) C++14
20 / 100
207 ms 536 KB
#include<bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define sz(x) ((int) x.size())
#define pb(x) push_back(x)

typedef long long ll;
typedef pair<int, int> point;

int a, b;

int cmp(int x, int y){
  cout << "cmp" _ x _ y << endl;
  fflush(stdout);
  int ret; cin >> ret;
  return ret;
}

void rev(int x, int y){
  if(x == y) return;
  cout << "reverse" _ x _ y << endl;
  fflush(stdout);
}

int main(){
  cin >> a >> b;
  int start = 1, end = a + b, len = a;
  REP(i, a){
    int lo = start + len, hi = end;

    while(lo < hi){
      int mid = (lo + hi + 1) >> 1;
      int ans = cmp(start, mid);

      if(ans <= 0)
        hi = mid - 1;
      else
        lo = mid;
    }
    if(start >= lo){
      start ++; len --;
      continue;
    }
    rev(start, lo);
    rev(lo - len + 1, lo);
    rev(start, lo - len);
    len --; start = lo - len + 1;
  }
  cout << "end";
  fflush(stdout);
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Incorrect 4 ms 452 KB Integer 100 violates the range [1, 99]
3 Incorrect 3 ms 532 KB Integer 101 violates the range [1, 100]
4 Incorrect 20 ms 532 KB Integer 998 violates the range [1, 997]
5 Incorrect 15 ms 532 KB Integer 982 violates the range [1, 981]
6 Incorrect 23 ms 532 KB Integer 1001 violates the range [1, 1000]
7 Incorrect 142 ms 532 KB Incorrect
8 Incorrect 207 ms 532 KB Incorrect
9 Correct 141 ms 536 KB Output is correct
10 Incorrect 88 ms 536 KB Total cost of reverse commands > 3 000 000