QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#364341 | #8311. Game on Sequence | ucup-team173# | WA | 1ms | 3672kb | C++20 | 1.4kb | 2024-03-24 13:50:36 | 2024-03-24 13:50:38 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define Mp make_pair
#define SZ(x) (int((x).size()))
typedef double db;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MAXN = 4e5 + 5;
int n, m, a[MAXN], cnt;
int last[256], sta[256];
int val[256];
void upd() {
sort(val, val + 256, [](int x, int y) {return last[x] < last[y];});
for(int i = 255; i >= 0; i--) {
int flg = 0;
for(int j = 1; j < 256; j <<= 1) {
int p = i ^ j;
if(last[p] > last[i] && !sta[p]) flg = 1;
}
sta[i] = flg;
}
}
void add(int x) {
++cnt, last[x] = cnt, sta[x] = 0, a[cnt] = x;
}
void solve() {
for(int i = 0; i < 256; i++) val[i] = i;
cin >> n >> m;
for(int i = 1, x; i <= n; i++) {
cin >> x, add(x);
}
upd();
for(int i = 1; i <= m; i++) {
int opt, k;
cin >> opt >> k;
if(opt == 1) add(k), upd();
else if(opt == 2) {
if(last[a[k]] != k) {
cout << "Grammy\n";
} else if(sta[a[k]]) {
cout << "Grammy\n";
} else {
cout << "Alice\n";
}
}
}
}
signed main() {
ios::sync_with_stdio(false), cin.tie(0);
int t = 1;
// cin >> t;
while(t--) solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3588kb
input:
5 5 1 2 3 4 5 1 6 2 5 1 7 2 5 2 1
output:
Alice Grammy Alice
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
10 10 12 114 132 7 133 53 128 159 34 92 2 5 1 254 2 3 2 11 1 92 2 11 1 33 1 230 1 181 2 11
output:
Alice Grammy Alice Alice Alice
result:
ok 5 lines
Test #3:
score: 0
Accepted
time: 1ms
memory: 3648kb
input:
100 100 57 58 24 217 80 0 241 175 19 138 231 17 8 19 22 100 133 205 178 67 55 92 127 254 156 89 87 22 136 208 168 195 164 194 243 110 234 164 78 55 43 223 227 112 137 78 111 31 253 194 196 128 210 129 71 129 40 195 114 69 114 52 83 162 248 117 12 162 86 155 81 6 251 174 237 190 171 44 61 114 254 131...
output:
Grammy Grammy Alice Alice Grammy Grammy Alice Alice Grammy Alice Grammy Grammy Grammy Alice Grammy Alice Alice Alice Alice Grammy Alice Grammy Alice Grammy Alice Grammy Grammy Alice Grammy Grammy Alice Alice Grammy Grammy Grammy Alice Alice Grammy Alice Grammy Grammy Grammy Grammy Alice Grammy Grammy
result:
ok 46 lines
Test #4:
score: -100
Wrong Answer
time: 1ms
memory: 3672kb
input:
200 200 56 236 246 71 3 39 174 73 229 150 161 184 163 240 96 38 57 65 238 184 84 105 70 169 217 155 211 197 92 224 245 239 170 146 131 155 63 225 68 84 208 81 117 55 195 58 70 118 178 71 93 215 236 248 81 51 244 32 48 247 0 103 249 166 123 200 35 84 131 20 21 45 108 110 171 236 59 206 184 100 43 126...
output:
Grammy Alice Alice Grammy Alice Grammy Grammy Grammy Grammy Grammy Grammy Grammy Alice Grammy Alice Alice Grammy Grammy Alice Alice Grammy Grammy Alice Grammy Alice Grammy Grammy Grammy Grammy Grammy Grammy Grammy Grammy Alice Alice Alice Grammy Grammy Grammy Grammy Grammy Grammy Grammy Grammy Alice...
result:
wrong answer 94th lines differ - expected: 'Alice', found: 'Grammy'