QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#547784 | #7517. Flying Ship Story | SICKO | WA | 0ms | 3580kb | C++17 | 4.7kb | 2024-09-05 10:10:48 | 2024-09-05 10:10:48 |
Judging History
answer
#include<iostream>
#define int long long
using namespace std;
struct poi{
int x{}, y{}, v{};
}p[20], np[20];
int pin1, pin2;
signed main(){
ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
int n, res = 0; cin>>n;
while(n--){
int opt, x, y, v;
cin>>opt;
if(opt == 1){
pin2=0;
cin>>x>>y>>v; x ^= res; y^= res; v^= res;
int lt = 1;
int nx, ny;
if(p[lt].v < v){
nx = x; ny = y;
np[++pin2] = {x, y, v}; v = -1;
}
else{
nx = p[lt].x; ny = p[lt].y;
np[++pin2] = p[lt++];
}
int lsx[4] = {0, 0, 0, 0}, lsy[4]={0, 0, 0, 0};
while(lt <= pin1 || v > 0){
poi pos;
if(p[lt].v < v) {
pos = {x, y, v}; v = -1;
}
else{
pos = p[lt++];
}
// 阶段1 十字
if(nx && ny){
// 无用
if(nx == pos.x && ny == pos.y) continue;
// 有用
np[++pin2] = pos;
// 阶段2
if(nx == pos.x && ny != pos.y){
ny = 0; continue;
}
if(nx != pos.x && ny == pos.y){
nx = 0; continue;
}
// 阶段3
if(nx != pos.x && ny != pos.y){
nx = ny = 0;
lsx[0] = lsy[0] = 2;
lsx[1] = nx; lsx[2] = pos.x;
lsy[1] = pos.y; lsy[2] = ny;
continue;
}
}
// 阶段2 单边的情况
else if(nx || ny){
if(nx){
// 无用
if(pos.x == nx) continue;
// 有用
np[++pin2] = pos;
// 进入一个点状态
lsx[0] = lsy[0] = 1;
lsx[1] = nx; lsy[1] = pos.y;
nx = 0;
continue;
}
// 无用
if(pos.y == ny) continue;
// 有用
np[++pin2] = pos;
// 进入一个点状态
lsx[0] = lsy[0] = 1;
lsx[1] = pos.x; lsy[1] = ny;
ny = 0;
continue;
}
// 阶段3 点的情况
else{
if(lsx[0] == 1){
// 无用
if(pos.x == lsx[1] || pos.y == lsy[1]) continue;
// 有用 全部结束
np[++pin2] = pos;
break;
}
if(lsx[0] == 2){
// 无用
if((pos.x == lsx[1] && pos.y == lsy[2]) || (pos.x == lsx[2] || pos.y == lsx[1])) continue;
// 有用
np[++pin2] = pos;
// 一个点
if((pos.x == lsx[2] || pos.y == lsy[2])){
// 进入一个点状态
lsx[0] = lsy[0] = 1;
lsx[1] = lsx[2]; lsy[1] = lsy[2];
continue;
}
if((pos.x == lsx[1] || pos.y == lsy[1])){
// 进入一个点状态
lsx[0] = lsy[0] = 1;
continue;
}
// 结束
break;
}
}
}
for(int i=1; i<=pin2; i++) p[i] = np[i], np[i] = {0, 0, 0};
pin1 = pin2;
if(pin1 < 4){
if(v > p[4].v){
pin1++; p[pin1] = {x, y, v};
}
if(p[4].v){
pin1++;
}
}
for(int i=1; i<=2; i++) p[i+pin1] = {0, 0, 0};
}
if(opt == 2){
res = 0;
cin>>x>>y; x ^= res; y ^= res;
for(int i=1; i<=pin1; i++){
if(p[i].x == x || p[i].y == y)
continue;
res = p[i].v;
break;
}
cout<<res<<"\n";
}
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3580kb
input:
5 1 2 3 1 1 4 5 2 2 2 2 2 3 7 2 3 4
output:
2 2 2
result:
wrong answer 2nd lines differ - expected: '1', found: '2'