結果
| 問題 |
No.1007 コイン集め
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-03-07 00:21:09 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 300 bytes |
| コンパイル時間 | 509 ms |
| コンパイル使用メモリ | 64,420 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-14 10:19:42 |
| 合計ジャッジ時間 | 1,750 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 4 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | main()
| ^~~~
ソースコード
#include<iostream>
using namespace std;
int N,K;
long A[2<<17];
main()
{
cin>>N>>K;
for(int i=0;i<N;i++)cin>>A[i];
long L=0,R=0;
K--;
for(int i=K;i>=0;i--)
{
L+=A[i];
if(A[i]<=1)break;
}
for(int i=K;i<N;i++)
{
R+=A[i];
if(A[i]<=1)break;
}
cout<<(A[K]==1?L<R?R:L:L+R-A[K])<<endl;
}