結果
問題 | No.2652 [Cherry 6th Tune N] Δρονε χιρχλινγ |
ユーザー | 沙耶花 |
提出日時 | 2024-02-23 22:26:31 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,915 bytes |
コンパイル時間 | 5,981 ms |
コンパイル使用メモリ | 277,588 KB |
実行使用メモリ | 17,452 KB |
最終ジャッジ日時 | 2024-02-23 22:27:19 |
合計ジャッジ時間 | 45,508 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,548 KB |
testcase_01 | AC | 419 ms
6,548 KB |
testcase_02 | AC | 444 ms
6,548 KB |
testcase_03 | AC | 418 ms
6,548 KB |
testcase_04 | AC | 422 ms
6,548 KB |
testcase_05 | AC | 428 ms
6,548 KB |
testcase_06 | AC | 419 ms
6,548 KB |
testcase_07 | AC | 449 ms
9,132 KB |
testcase_08 | AC | 447 ms
9,064 KB |
testcase_09 | AC | 438 ms
10,024 KB |
testcase_10 | AC | 435 ms
9,048 KB |
testcase_11 | AC | 450 ms
8,828 KB |
testcase_12 | AC | 430 ms
9,976 KB |
testcase_13 | AC | 441 ms
13,496 KB |
testcase_14 | WA | - |
testcase_15 | AC | 440 ms
12,096 KB |
testcase_16 | AC | 435 ms
9,976 KB |
testcase_17 | AC | 486 ms
11,052 KB |
testcase_18 | AC | 467 ms
11,444 KB |
testcase_19 | AC | 436 ms
13,304 KB |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | AC | 368 ms
16,188 KB |
testcase_41 | AC | 363 ms
16,700 KB |
ソースコード
#include <stdio.h> #include <bits/stdc++.h> #include <atcoder/all> using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 1000000000000000001 int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int _t; cin>>_t; rep(_,_t){ int N,L; cin>>N>>L; vector<pair<int,int>> x(N); rep(i,N){ cin>>x[i].first>>x[i].second; } sort(x.begin(),x.end()); vector<pair<int,int>> ans; int s2; { set<pair<int,int>> S; int sz = 0; vector<vector<pair<int,int>>> ls(N); rep(i,N){ int t = x[i].second; auto it = S.upper_bound(make_pair(t,2000000000)); if(S.begin()==it){ S.emplace(t,i); ls[i].push_back(x[i]); } else{ it--; ls[it->second].push_back(x[i]); int tt = it->second; S.erase(it); S.emplace(t,tt); } } vector<pair<int,int>> t; rep(i,N){ if(ls[i].size()>0){ if(sz%2)reverse(ls[i].begin(),ls[i].end()); rep(j,ls[i].size())t.push_back(ls[i][j]); sz++; } } ans = t; s2 = sz; } rep(i,N)x[i].first *= -1; sort(x.begin(),x.end()); rep(i,N)x[i].first *= -1; { set<pair<int,int>> S; int sz = 0; vector<vector<pair<int,int>>> ls(N); rep(i,N){ int t = x[i].second; auto it = S.upper_bound(make_pair(t,2000000000)); if(S.begin()==it){ S.emplace(t,i); ls[i].push_back(x[i]); } else{ it--; ls[it->second].push_back(x[i]); int tt = it->second; S.erase(it); S.emplace(t,tt); } } vector<pair<int,int>> t; rep(i,N){ if(ls[i].size()>0){ if(sz%2)reverse(ls[i].begin(),ls[i].end()); rep(j,ls[i].size())t.push_back(ls[i][j]); sz++; } } if(s2>sz)ans = t; } cout<<N<<endl; rep(i,N){ cout<<ans[i].first<<' '<<ans[i].second<<endl; } } return 0; }