QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#225353 | #7521. Find the Gap | PetroTarnavskyi# | WA | 0ms | 3544kb | C++17 | 1.6kb | 2023-10-24 15:48:46 | 2023-10-24 15:48:47 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;
map<int, int> cnt[2];
void erase(int t, int x)
{
cnt[t][x]--;
if (cnt[t][x] == 0)
cnt[t].erase(x);
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout << fixed << setprecision(15);
return 0;
int q;
cin >> q;
int last = 0;
set<pair<int, PII>> s;
FOR (i, 0, q)
{
int t;
cin >> t;
if (t == 1)
{
int x, y, W;
cin >> x >> y >> W;
x ^= last;
y ^= last;
W ^= last;
s.insert({W, {x, y}});
cnt[0][x]++;
cnt[1][y]++;
if (cnt[0][x] == 4)
{
for (auto [w, p] : s)
{
if (p.F == x)
{
erase(0, p.F);
erase(1, p.S);
s.erase({w, p});
break;
}
}
}
if (cnt[1][y] == 4)
{
for (auto [w, p] : s)
{
if (p.S == y)
{
erase(0, p.F);
erase(1, p.S);
s.erase({w, p});
break;
}
}
}
if (SZ(s) > 14)
{
auto p = s.begin()->S;
erase(0, p.F);
erase(1, p.S);
s.erase(s.begin());
}
}
else
{
int x, y;
cin >> x >> y;
x ^= last;
y ^= last;
int ans = 0;
for (auto [w, p] : s)
{
if (p.F != x && p.S != y)
ans = max(ans, w);
}
cout << ans << '\n';
last = ans;
}
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3544kb
input:
8 1 1 1 1 1 2 1 2 1 1 2 2 2 1 1 2 1 2 2 2 1 2 2 2
output:
result:
wrong output format Unexpected end of file - double expected