結果
問題 | No.2343 (l+r)/2 |
ユーザー |
![]() |
提出日時 | 2023-06-09 21:29:41 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 338 ms / 2,000 ms |
コード長 | 1,434 bytes |
コンパイル時間 | 3,654 ms |
コンパイル使用メモリ | 253,908 KB |
最終ジャッジ日時 | 2025-02-13 23:48:18 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 14 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:79:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 79 | scanf("%d",&a[i]); | ~~~~~^~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <atcoder/all> #include <bits/stdc++.h> using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 4000000000000000001 bool check(vector<double> a){ if(a.size()==1)return abs(a[0]-0.5)<1e-10; rep(i,a.size()-1){ auto b = a; b.erase(b.begin()+i,b.begin()+i+2); b.insert(b.begin()+i,(a[i] + a[i+1])/2.0); if(check(b))return true; } return false; } bool sol(vector<int> a){ int c = 0; int n =a.size(); //if(n>=10)return true; rep(i,n-1){ if(a[i]!=a[i+1])c++; } if(c%2==1 || c>=8){ return true; } int t = a[0]^1; c = 0; rep(i,n-1){ if(a[i]==t && a[i+1]==t){ c = 1; } } if(c){ return true; } else{ return false; } } int main(){ int _t; cin>>_t; /* rep(i,1<<_t){ vector<int> a(_t); vector<double> b(_t); rep(j,_t){ if((i>>j)&1){ a[j] = 1; b[j] = 1; } else{ a[j] = 0; b[j] = 0; } } if(sol(a)!=check(b)){ cout<<(bitset<10>(i))<<":"<<endl; cout<<sol(a)<<endl; cout<<check(b)<<endl; } } */ rep(_,_t){ int n; cin>>n; vector<int> a(n); rep(i,n){ scanf("%d",&a[i]); } //cout<<sol(a)<<','<<check(b)<<endl; if(sol(a))cout<<"Yes"<<endl; else cout<<"No"<<endl; /* { vector<double> b(n); rep(i,n)b[i] = a[i]; cout<<check(b)<<endl; } cout<<sol(a)<<endl; */ } return 0; }