結果
問題 | No.190 Dry Wet Moist |
ユーザー | face4 |
提出日時 | 2019-02-13 09:57:15 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,031 bytes |
コンパイル時間 | 887 ms |
コンパイル使用メモリ | 77,360 KB |
実行使用メモリ | 4,760 KB |
最終ジャッジ日時 | 2023-10-11 11:06:11 |
合計ジャッジ時間 | 3,831 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,372 KB |
testcase_01 | AC | 2 ms
4,372 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 36 ms
4,396 KB |
testcase_13 | AC | 44 ms
4,428 KB |
testcase_14 | AC | 35 ms
4,368 KB |
testcase_15 | AC | 49 ms
4,428 KB |
testcase_16 | AC | 61 ms
4,760 KB |
testcase_17 | AC | 9 ms
4,368 KB |
testcase_18 | AC | 29 ms
4,368 KB |
testcase_19 | AC | 60 ms
4,584 KB |
testcase_20 | AC | 42 ms
4,460 KB |
testcase_21 | AC | 7 ms
4,372 KB |
testcase_22 | AC | 68 ms
4,620 KB |
testcase_23 | AC | 76 ms
4,700 KB |
testcase_24 | AC | 75 ms
4,568 KB |
testcase_25 | AC | 2 ms
4,368 KB |
testcase_26 | AC | 3 ms
4,368 KB |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
ソースコード
#include<iostream> #include<vector> #include<algorithm> using namespace std; int main(){ int n; cin >> n; vector<int> v(2*n), plus(100001, 0), minus(100001, 0); int z = 0; for(int i = 0; i < 2*n; i++){ cin >> v[i]; if(v[i] > 0) plus[v[i]]++; else if(v[i] < 0) minus[-v[i]]++; else z++; } sort(v.begin(), v.end()); int d = 0, w = 0, m = 0; // dry int r = lower_bound(v.begin(), v.end(), 0)-v.begin(); int l = r-1; while(0 <= l && r < 2*n){ if(v[l]+v[r] < 0) d++, l--, r++; else l--; } if(l >= 0) d += (l+1)/2; // wet r = upper_bound(v.begin(), v.end(), 0)-v.begin(); l = r-1; while(0 <= l && r < 2*n){ if(v[l]+v[r] > 0) w++, l--, r++; else r++; } if(r < 2*n) w += (2*n-1-r+1)/2; // moist m += z/2; for(int i = 1; i < 100001; i++) m += min(plus[i], minus[i]); printf("%d %d %d\n", d, w, m); return 0; }