QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#547752 | #7517. Flying Ship Story | SICKO | WA | 206ms | 3680kb | C++17 | 4.6kb | 2024-09-05 09:18:04 | 2024-09-05 09:18:04 |
Judging History
answer
#include<iostream>
#define int long long
using namespace std;
struct poi{
int x, y, v;
[[nodiscard]] bool cross(const poi &A) const{
return x == A.x || y == A.y;
}
}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;
for(int i=1; i<=2; i++) p[i+pin1] = {0, 0, 0};
}
if(opt == 2){
cin>>x>>y; x ^= res; y ^= res;
bool flat = false;
for(int i=1; i<=pin1; i++){
if(p[i].cross({x, y, 0}))
continue;
flat = true; res = p[i].v;
break;
}
if(!flat) res = 0;
cout<<res<<"\n";
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3588kb
input:
5 1 2 3 1 1 4 5 2 2 2 2 2 3 7 2 3 4
output:
2 1 0
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 184ms
memory: 3600kb
input:
1000000 2 370943499 431961772 1 1 1 11995570 2 37566858 838793045 1 11995571 11995569 908148975 2 11995571 11995571 1 1 3 716821068 2 67877937 3 1 11995571 11995571 771898489 2 38381714 99749723 1 915818844 915818847 729541681 2 592361351 915818846 1 783627722 783627722 639375021 2 102203700 8636489...
output:
0 11995570 0 11995570 915818845 783627723 915818845 0 0 915818845 0 783627723 0 904468304 904468304 904468304 915818845 904468304 915818845 904468304 915818845 0 904468304 0 915818845 915818845 0 0 915818845 915818845 0 921710773 0 921710773 998138906 921710773 0 921710773 998138906 0 998138906 0 99...
result:
ok 500000 lines
Test #3:
score: -100
Wrong Answer
time: 206ms
memory: 3680kb
input:
1000000 2 648544745 437316088 1 1 1 221075686 2 802693951 691188141 1 221075687 221075684 1036811136 2 771835961 178451319 1 820061031 820061031 560017372 2 829408420 820061028 1 293604539 293604539 699366423 2 293604539 293604539 1 1 2 610044241 2 50747012 885321059 1 942633132 942633132 603537610 ...
output:
0 221075686 820061030 293604538 0 942633133 942633133 27478144 820061030 820061030 900696946 27478144 942633133 942633133 0 772167494 27478144 891145650 900696946 772167494 891145650 918281274 772167494 772167494 772167494 772167494 772167494 942633133 918281274 891145650 918281274 891145650 8911456...
result:
wrong answer 187th lines differ - expected: '964709133', found: '0'