QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#707046#7517. Flying Ship StoryDeltaxWA 110ms3968kbC++141.5kb2024-11-03 14:29:262024-11-03 14:29:27

Judging History

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

  • [2024-11-03 14:29:27]
  • 评测
  • 测评结果:WA
  • 用时:110ms
  • 内存:3968kb
  • [2024-11-03 14:29:26]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mkp make_pair
#define pb push_back
typedef pair <int, int> pii;

inline int read() {
	int x = 0, f = 0;
	char c = getchar();
	while (!isdigit(c)) {if (c == '-') f = 1; c = getchar();}
	while (isdigit(c)) x = (x << 1) + (x << 3) + (c & 15), c = getchar();
	return f? -x : x;
}

struct node {
	int x, y, w;
	inline node() {}
	inline node(int x_, int y_, int w_) {x = x_, y = y_, w = w_;}
};
inline bool operator < (const node &x, const node &y) {
	return x.w < y.w;
}

node mx[4];
inline node chk(node p, int o) {
	const node ze = node(0, 0, 0);
	if (o == 1 && p.x == mx[0].x) return ze; //different x
	if (o == 2 && p.y == mx[0].y) return ze; //different y
	if (o == 3 && (p.x == mx[0].x || p.y == mx[0].y)) return ze; //x & y
	return p;
}

void upd(node x) {
	if (mx[0].w < x.w)
		swap(mx[0], x);
	static int pp[4] = {3, 2, 1, 2};
	for (int i = 0; i < 4; ++i) {
		int j = pp[i];
		node p1 = chk(mx[j], j);
		node p2 = chk(x, j);
		if (p1 < p2) swap(mx[j], x);
	}
}

int main() {
	int Q = read(), ans = 0;
	while (Q--) {
		int op = read();
		if (op == 1) {
			int x = read(), y = read(), w =read();
			x ^= ans;
			y ^= ans;
			w ^= ans;
			upd(node(x, y, w));
		}
		else {
			int x = read(), y = read();
			x ^= ans;
			y ^= ans;
			ans = 0;
			for (int i = 0; i < 4; ++i) {
				if (mx[i].x != x && mx[i].y != y)
					ans = max(ans, mx[i].w);
			}
			printf("%d\n", ans);
		}
	}
	return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3968kb

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: 99ms
memory: 3856kb

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: 110ms
memory: 3804kb

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 87th lines differ - expected: '878786765', found: '0'