結果
| 問題 |
No.190 Dry Wet Moist
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-11-01 17:22:08 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 882 bytes |
| コンパイル時間 | 571 ms |
| コンパイル使用メモリ | 71,960 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-25 00:57:26 |
| 合計ジャッジ時間 | 2,159 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 4 WA * 24 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#define repeat(i,n) for (int i = 0; (i) < (n); ++(i))
#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
using namespace std;
template <typename T> T input(istream & in) { T a; in >> a; return a; }
int signof(int x) { return x > 0 ? 1 : x < 0 ? -1 : 0; }
int foo(vector<int> const & a, int sign) {
int cnt = 0;
for (int i = 0, j = a.size() - 1; i < j; ++ i, -- j) {
while (i < j and signof(a[i] + a[j]) != sign) -- j;
if (i == j) break;
++ cnt;
}
return cnt;
}
int main() {
int n; cin >> n;
vector<int> a(2*n); repeat (i,2*n) cin >> a[i];
int dry = foo(a, -1);
int moist = foo(a, 0);
whole(reverse, a);
int wet = foo(a, 1);
cout << dry << ' ' << wet << ' ' << moist << endl;
return 0;
}