跳到正文

剪贴板

剪贴板 o428grae

原文
剪贴板信息

剪贴板信息

收录
更新
C++
#include<bits/stdc++.h>
using namespace std;

int real_array[1005], size, query_times;

extern "C" bool Query(int a, int b){
  if(a > size || b > size || a == b || a < 0 || b < 0){cout << "Invaild Query:" << a << " " << b; assert(0);}
  query_times++;
  bool flg = (real_array[a] > real_array[b]);
  if(abs(real_array[a] - real_array[b]) == 1) flg ^= 1;
  return flg;
}
extern "C" std::vector<int> Solve(int N);

signed main(){
  int limit = 25000;
  cin >> size; int n = size;
  for(int i = 0; i < n; i++) cin >> real_array[i];
  vector<int> ans = Solve(n);
  cout << "Query times: " << query_times << "\n";
  //  for(int i = 0; i < n; i++) cout << ans[i] << " "; cout << "\n";
  for(int i = 0; i < n; i++) if(ans[i] != real_array[i]){cout << "Wrong Answer\n"; return 0;}
  if(query_times > limit){cout << "Too many Querys"; return 0;}
  cout << "Accept\n";

  return 0;
}