結果
問題 | No.190 Dry Wet Moist |
ユーザー |
![]() |
提出日時 | 2015-04-22 00:25:21 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 77 ms / 2,000 ms |
コード長 | 1,272 bytes |
コンパイル時間 | 783 ms |
コンパイル使用メモリ | 89,420 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-04 20:22:08 |
合計ジャッジ時間 | 2,420 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 28 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:67:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘ll’ {aka ‘long long int’} [-Wformat=] 67 | printf("%d %d %d\n", res[0], res[1], res[2]); | ~^ ~~~~~~ | | | | int ll {aka long long int} | %lld main.cpp:67:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ll’ {aka ‘long long int’} [-Wformat=] 67 | printf("%d %d %d\n", res[0], res[1], res[2]); | ~^ ~~~~~~ | | | | int ll {aka long long int} | %lld main.cpp:67:24: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘ll’ {aka ‘long long int’} [-Wformat=] 67 | printf("%d %d %d\n", res[0], res[1], res[2]); | ~^ ~~~~~~ | | | | int ll {aka long long int} | %lld
ソースコード
#include <algorithm>#include <climits>#include <cmath>#include <cstdio>#include <cstdlib>#include <ctime>#include <iostream>#include <sstream>#include <functional>#include <map>#include <string>#include <cstring>#include <vector>#include <queue>#include <stack>#include <deque>#include <set>#include <list>#include <numeric>using namespace std;const double PI = 3.14159265358979323846;const double EPS = 1e-12;const int INF = 1<<25;typedef pair<int,int> P;typedef long long ll;typedef unsigned long long ull;map<int, int> dc;int main(){int n;cin>>n;n *= 2;vector<int> d(n);for(int i = 0; i < n; i++) cin>>d[i];sort(d.begin(), d.end());// for(int i = 0; i < n; i++) ++dc[d[i]];ll res[3] = {};int pos = n-1;// while(pos>=0 && d[0]+d[pos]>=0) pos++;for(int i = 0; i < n; i++){while(pos>i && d[i]+d[pos]>=0) pos--;if(pos<=i){res[0] = i;break;}pos--;}pos = 0;for(int i = n-1; i >= 0; i--){while(pos<i && d[i]+d[pos]<=0) pos++;if(pos>=i){res[1] = n-i-1;break;}pos++;}pos = n-1;for(int i = 0; i < n; i++){while(pos>i&& d[i]+d[pos]>0) pos--;if(pos<=i) break;if(d[i]+d[pos]==0){res[2]++;pos--;}}printf("%d %d %d\n", res[0], res[1], res[2]);return 0;}