QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#61567#4830. Transfer of DutyPitiless05140 44ms10396kbC++142.9kb2022-11-14 09:11:582023-02-13 20:54:34

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-13 20:54:34]
  • 评测
  • 测评结果:0
  • 用时:44ms
  • 内存:10396kb
  • [2022-11-14 09:11:58]
  • 提交

answer

// 德丽莎你好可爱德丽莎你好可爱德丽莎你好可爱德丽莎你好可爱德丽莎你好可爱
// 德丽莎的可爱在于德丽莎很可爱,德丽莎为什么很可爱呢,这是因为德丽莎很可爱!
// 没有力量的理想是戏言,没有理想的力量是空虚
#include <bits/stdc++.h>
#define LL long long
#define int long long
using namespace std;
namespace IO {
  const int SZ = (1 << 21) + 1;
  char ib[SZ], *iS, *iT, ob[SZ], *oS = ob, *oT = oS + SZ - 1, cc, qu[55]; int ff, qr;
  #define gc() (iS == iT ? (iT = (iS = ib) + fread(ib, 1, SZ, stdin), (iS == iT ? EOF : *iS++)) : *iS++)
  void flush() { fwrite(ob, 1, oS - ob, stdout), oS = ob; }
  void putc(char x) { *oS++ = x; if (oS == oT) flush(); }
  template <class I>
  void read(I &x) {
    for (ff = 1, cc = gc(); cc < '0' || cc > '9'; cc = gc()) if (cc == '-')  ff = -1;
    for (x = 0; cc <= '9' && cc >= '0'; cc = gc())  x = x * 10 + (cc & 15);
    x *= ff;
  }
  template <class I, class... Y>
  void read(I &t, Y &... a) {  read(t), read(a...);  }
  template <class I>
  void write(I x) {
    if (!x)  putc('0');
    if (x < 0) putc('-'), x = -x;
    while (x) qu[++qr] = x % 10 + '0', x /= 10;
    while (qr) putc(qu[qr --]);
  }
} using namespace IO;
template<class T> bool chkmin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool chkmax(T &a, T b) { return a < b ? (a = b, true) : false; }
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define repd(i, l, r) for (int i = (l); i >= (r); i--)
#define REP(i, l, r)  for (int i = (l); i < (r); i++)
#define uint unsigned long long
bool o1;
const int N = 2e5;
string id;
int lim = 1e5, m;
uint a[N];
map <uint,int> mp;
void solve() {
  mt19937 rnd(20060514);
  rep (i, 1, lim)  a[i] = (uint)rnd() * rnd(), mp[ a[i] ] = i;
  cin >> id;
  if (id == "start") {
    cin >> m;
    uint now = 0;
    rep (i, 1, m) {
      int x;
      cin >> x;
      now ^= a[x];
      if (now == 0) {
        cout << "0\n";
      } else if (mp.find(now) != mp.end()) {
        cout << mp[now] << "\n";
      } else {
        cout << "-1\n";
      }
    }
    cout << now << "\n";
  } else {
    uint s ;
    cin >> s;
    cin >> m;
    rep (i, 1, m) {
      int x;
      cin >> x;
      s ^= a[x];
      if (s == 0) {
        cout << "0\n";
      } else if (mp.find(s) != mp.end()) {
        cout << mp[s] << "\n";
      } else {
        cout << "-1\n";
      }
    }
  }
}
bool o2;
signed main () {
#ifdef LOCAL_DEFINE
  cerr << "Memory elapsed: " << 1.0 * (&o1 - &o2) / 1024 / 1024 << ".Mib\n";
  freopen("1.in", "r", stdin);
  freopen("1.ans", "w", stdout);
#endif
  ios :: sync_with_stdio(0);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int T = 1; while (T--)  solve();
  flush();
#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 44ms
memory: 10396kb

input:

start
5
10
14
10
12
10

output:

10
-1
14
-1
-1
15203117146538099759

input:

resume
15203117146538099759
6
14
277
12
10
277
12

output:

-1
-1
-1
277
0
12

result:

ok 

Test #2:

score: 100
Accepted
time: 39ms
memory: 10384kb

input:

start
1
1

output:

1
1535327457901956163

input:

resume
1535327457901956163
1
1

output:

0

result:

ok 

Test #3:

score: 0
Stage 1: Program answer Runtime Error

input:

start
1
1000000

output:


input:


output:


result: