QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#136613#237. Triangle Partitionwhsyhyyh#100 ✓6ms3636kbC++14920b2023-08-09 09:22:112023-08-09 09:22:11

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-09 09:22:11]
  • 评测
  • 测评结果:100
  • 用时:6ms
  • 内存:3636kb
  • [2023-08-09 09:22:11]
  • 提交

answer

#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline")
#pragma GCC option("arch=native","tune=native","no-zero-upper")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2")
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define N 3010
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define drep(i,r,l) for(int i=r;i>=l;i--)
using namespace std;
int rd() {
	int res=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-') f*=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') res=(res<<1)+(res<<3)+(ch^48),ch=getchar();
	return res*f;
}
int T,n;
struct node {
	int x,y,id;
}q[N];
bool cmp(node x,node y) {
	if(x.x!=y.x) return x.x<y.x;
	return x.y<y.y;
}
int main() {
	T=rd();
	while(T--) {
		n=rd();
		rep(i,1,n*3) q[i].x=rd(),q[i].y=rd(),q[i].id=i;
		sort(q+1,q+n*3+1,cmp);
		rep(i,1,n) printf("%d %d %d\n",q[i*3-2].id,q[i*3-1].id,q[i*3].id);
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 6ms
memory: 3636kb

input:

190
10
-7215 2904
-5179 1663
-542 1091
-5687 7868
7838 -1048
-2944 4346
-2780 3959
-9402 1099
-8548 -7238
-3821 -2917
2713 295
-856 -8661
7651 3945
-8216 -543
5798 5024
8583 -3384
-1208 5955
3068 -385
340 2968
6559 -272
4537 5075
5126 4343
639 8281
1700 2572
819 9317
-9854 -1316
-3421 -1137
9368 718...

output:

26 8 9
14 29 1
4 2 10
27 6 7
17 12 3
19 23 25
24 11 18
21 22 15
20 30 13
5 16 28
30 3 18
29 5 17
12 11 27
15 19 10
28 25 9
24 7 13
6 8 23
14 22 2
20 4 16
26 21 1
6 11 16
8 27 10
13 15 14
29 22 19
9 2 18
24 12 20
1 26 4
5 30 7
3 25 23
17 21 28
16 8 18
19 23 13
7 26 24
3 1 5
29 25 27
9 6 15
12 22 14
1...

result:

ok AC