QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#136635#237. Triangle PartitionOrange_JuiCE#100 ✓19ms3716kbC++171.2kb2023-08-09 09:32:592023-08-09 09:33:00

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:33:00]
  • 评测
  • 测评结果:100
  • 用时:19ms
  • 内存:3716kb
  • [2023-08-09 09:32:59]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
#define IOS ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define rep(a, b, c) for(int (a)=(b);(a)<=(c);(a)++)
#define per(a, b, c) for(int (a)=(b);(a)>=(c);(a)--)
#define mset(var, val) memset(var,val,sizeof(var))
#define ll long long
#define int ll
#define fi first
#define se second
#define pb push_back
// #define endl "\n"
#define pii pair<int,int>
#define pll pair<ll,ll>
#define dbg(x...) do{cout<<#x<<" -> ";err(x);}while (0)

void err() { cout << '\n'; }

template<class T, class... Ts>
void err(T arg, Ts... args) {
    cout << arg << ' ';
    err(args...);
}

const int N = 3e3+5;
int n;

struct node {
    int x, y, id;
    bool operator <(const node &B)const{
        return (x > B.x) || (x == B.x && y < B.y);
    }
}a[N];

void solve() {
    cin >> n;
    for(int i = 1; i <= 3*n; i++) {
        cin >> a[i].x >> a[i].y;
        a[i].id = i;
    }
    sort(a+1, a+1+3*n);
    for(int i = 1; i <= 3*n; i+=3){
        cout << a[i].id << " " << a[i+1].id << " " << a[i+2].id << endl;
    }
}

signed main() {
    IOS;
    int T = 1;
    cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 19ms
memory: 3716kb

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:

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

result:

ok AC