QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#296104#4830. Transfer of Dutyphtniit#0 0ms0kbC++141.3kb2024-01-02 09:18:182024-01-02 09:18:19

Judging History

你现在查看的是最新测评结果

  • [2024-01-02 09:18:19]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-01-02 09:18:18]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

typedef long double ldb;
typedef long long i64;
typedef unsigned long long u64;
typedef unsigned int u32;
typedef pair<int, int> pii;

// priority_queue<int, vector<int>, greater<int>> minq;
// ios::sync_with_stdio(0);cin.tie(0);
// fflush(stdout);

const int inf = 1000000007;
const i64 prm = 998244353;
const i64 inf2 = ((i64)inf) * inf;
const int maxn = 1100010; // 1.1e6

inline int read(){
  int x=0,f=0; char ch=getchar();
  while(!isdigit(ch)) f|=(ch==45),ch=getchar();
  while(isdigit(ch)) x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
  return f?-x:x;
}

std::mt19937_64 rng(9901);
void A() {
}

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

  const int lim = 1e6;

  static u64 a[maxn];
  map<u64, int> M;
  for (int i = 1; i <= lim; ++i) {
    a[i] = rng();
    M[a[i]] = i;
  }
  assert(M.size() == lim);

  string s;
  cin >> s;
  u64 w = 0;
  if (s[0] == 'r') {
    cin >> w;
  }
  int k = read();
  for (int i = 0; i < k; ++i) {
    int p = read();
    w ^= a[p];
    if (w == 0) {
      cout << 0 << "\n";
    } else if (M.find(w) != M.end()) {
      cout << M[w] << "\n";
    } else {
      cout << -1 << "\n";
    }
  }
  if (s[0] == 's') {
    cout << w << endl;
  }
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Stage 1: Program answer Time Limit Exceeded

input:

start
5
10
14
10
12
10

output:


input:


output:


result: