QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#162556#237. Triangle PartitionSolitaryDream#100 ✓9ms3596kbC++14684b2023-09-03 14:15:282023-09-03 14:15:30

Judging History

This is the latest submission verdict.

  • [2023-09-03 14:15:30]
  • Judged
  • Verdict: 100
  • Time: 9ms
  • Memory: 3596kb
  • [2023-09-03 14:15:28]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
#define FOR(i,s,t) for(int i=(s),_t=(t); i<=_t; ++i)
#define DOR(i,s,t) for(int i=(s),_t=(t); i>=_t; --i)
typedef long long ll;
void solve() {
    int n;
    cin >> n;
    vector<pair<pair<int,int>,int>> a;
    FOR(i,1,3*n) {
        int x,y;
        cin >> x >> y;
        a.push_back({{x,y},i});
    }
    sort(a.begin(),a.end());
    for(int i=0; i<a.size(); i+=3) {
        cout << a[i].second << ' ' << a[i+1].second << ' ' << a[i+2].second << '\n';
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T;
    cin >> T;
    while(T--) {
        solve();
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 9ms
memory: 3596kb

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