結果
| 問題 |
No.59 鉄道の旅
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-04-24 04:43:04 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 80 ms / 5,000 ms |
| コード長 | 267 bytes |
| コンパイル時間 | 596 ms |
| コンパイル使用メモリ | 44,112 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-24 20:37:01 |
| 合計ジャッジ時間 | 1,498 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 12 |
コンパイルメッセージ
main.cpp:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<deque>
| ^~~~~~
main.cpp:2:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
2 | #import<cstdio>
| ^~~~~~
main.cpp:3:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
3 | main(){std::deque<int>v;int N,K,n;scanf("%d%d",&N,&K);for(;N--;){scanf("%d",&n);auto it=std::lower_bound(v.begin(),v.end(),n>0?n:-n);if(n>0&&v.end()-it<K)v.insert(it,n);if(n<0&&it!=v.end()&&*it==-n)v.erase(it);}printf("%d\n",v.size());}
| ^~~~
main.cpp: In function ‘int main()’:
main.cpp:3:221: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::deque<int>::size_type’ {aka ‘long unsigned int’} [-Wformat=]
3 | main(){std::deque<int>v;int N,K,n;scanf("%d%d",&N,&K);for(;N--;){scanf("%d",&n);auto it=std::lower_bound(v.begin(),v.end(),n>0?n:-n);if(n>0&&v.end()-it<K)v.insert(it,n);if(n<0&&it!=v.end()&&*it==-n)v.erase(it);}printf("%d\n",v.size());}
| ~^ ~~~~~~~~
| | |
| int std::deque<int>::size_type {aka long unsigned int}
|
ソースコード
#import<deque>
#import<cstdio>
main(){std::deque<int>v;int N,K,n;scanf("%d%d",&N,&K);for(;N--;){scanf("%d",&n);auto it=std::lower_bound(v.begin(),v.end(),n>0?n:-n);if(n>0&&v.end()-it<K)v.insert(it,n);if(n<0&&it!=v.end()&&*it==-n)v.erase(it);}printf("%d\n",v.size());}