結果
| 問題 |
No.2655 Increasing Strides
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-01 21:22:38 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 425 bytes |
| コンパイル時間 | 512 ms |
| コンパイル使用メモリ | 71,992 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-09-29 13:26:02 |
| 合計ジャッジ時間 | 1,366 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 28 WA * 6 |
ソースコード
#include<iostream>
#include<vector>
#include<cassert>
using namespace std;
bool ok(vector<int>A)
{
long sum=0;
for(int a:A)sum+=a;
if(sum%2==1)return false;
sum/=2;
for(int i=A.size();i--;)
{
sum=abs(sum-A[i]);
}
return sum==0;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N;cin>>N;
vector<int>L,R;
for(int i=1;i<=N;i++)(i%2==1?L:R).push_back(i);
cout<<(ok(L)&&ok(R)?"Yes":"No")<<endl;
}