답안 #90561

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
90561 2018-12-22T11:56:18 Z Milki Nizovi (COI14_nizovi) C++14
0 / 100
4 ms 640 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 << "\n";
  fflush(stdout);
  int ret; cin >> ret;
  return ret;
}

void rev(int x, int y){
  cout << "reverse" _ x _ y << "\n";
  fflush(stdout);
}

int main(){
  ios_base::sync_with_stdio(false); cin.tie(0);

  cin >> a >> b;
  int total = a + b, curr = a;
  while(curr){
    int lo = curr + 1, hi = total;
    while(lo < hi){
      int mid = (lo + hi) >> 1;
      int ans = cmp(curr, mid);
      if(ans == -1)
        hi = mid;
      else if(ans == 1)
        lo = mid + 1;
      else{
        lo = mid;
        break;
      }
    }
    rev(curr, lo);
    rev(curr, lo - 1);
    curr --; total = lo;
  }
  cout << "end\n";
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2 ms 376 KB Time limit exceeded (wall clock)
2 Execution timed out 1 ms 376 KB Time limit exceeded (wall clock)
3 Execution timed out 2 ms 404 KB Time limit exceeded (wall clock)
4 Execution timed out 2 ms 424 KB Time limit exceeded (wall clock)
5 Execution timed out 2 ms 468 KB Time limit exceeded (wall clock)
6 Execution timed out 4 ms 468 KB Time limit exceeded (wall clock)
7 Execution timed out 2 ms 468 KB Time limit exceeded (wall clock)
8 Execution timed out 2 ms 468 KB Time limit exceeded (wall clock)
9 Execution timed out 2 ms 468 KB Time limit exceeded (wall clock)
10 Execution timed out 2 ms 640 KB Time limit exceeded (wall clock)