結果
問題 | No.870 無敵囲い |
ユーザー | t98slider |
提出日時 | 2020-06-14 02:39:23 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 2 ms / 300 ms |
コード長 | 10,965 bytes |
コンパイル時間 | 1,546 ms |
コンパイル使用メモリ | 174,572 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-29 06:41:59 |
合計ジャッジ時間 | 2,319 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 2 ms
5,376 KB |
testcase_04 | AC | 1 ms
5,376 KB |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | AC | 1 ms
5,376 KB |
testcase_07 | AC | 2 ms
5,376 KB |
testcase_08 | AC | 2 ms
5,376 KB |
testcase_09 | AC | 2 ms
5,376 KB |
testcase_10 | AC | 2 ms
5,376 KB |
testcase_11 | AC | 2 ms
5,376 KB |
testcase_12 | AC | 2 ms
5,376 KB |
testcase_13 | AC | 2 ms
5,376 KB |
testcase_14 | AC | 2 ms
5,376 KB |
testcase_15 | AC | 1 ms
5,376 KB |
testcase_16 | AC | 2 ms
5,376 KB |
testcase_17 | AC | 2 ms
5,376 KB |
testcase_18 | AC | 1 ms
5,376 KB |
testcase_19 | AC | 2 ms
5,376 KB |
testcase_20 | AC | 2 ms
5,376 KB |
ソースコード
#include <bits/stdc++.h> #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define vec_input(v) for(auto it=v.begin();it!=v.end();it++){cin>>*it;} #define vec_debug(v) for(auto it=v.begin();it!=v.end();it++){cerr<<*it<<" ";}cerr<<endl; #define yn(ans) cout<<(ans?"Yes":"No")<<endl #define YN(ans) cout<<(ans?"YES":"NO")<<endl using namespace std; using ll = long long; template <typename T>T digitsum(T n); template <typename T>bool isPrime(T n); template <typename T>vector<pair<T, T>> prime_factor(T n); long long int intpow(long long int,long long int); template <typename T>T intlog(T); long long int combination(long long int,long long int); long long int series_sum(long long int); int main(){ struct point{int x,y;}; vector<point> vec(3); vec[0].x=2; vec[0].y=8; vec[1].x=3; vec[1].y=9; vec[2].x=7; vec[2].y=9; point p1,p2; ll n; cin>>n; rep(i,n){ cin>>p1.x>>p1.y>>p2.x>>p2.y; rep(j,3){ if(p1.x==vec[j].x&&p1.y==vec[j].y){ vec[j].x=p2.x; vec[j].y=p2.y; } } } YN(vec[0].x==5&&vec[0].y==8 &&vec[1].x==4&&vec[1].y==8 &&vec[2].x==6&&vec[2].y==8); } /*int main(){ ll r,g,b,n,ans=0,b2; cin>>r>>g>>b>>n; for(int i=0;i*r<=n;i++){ for(int j=0;j*g<=n;j++){ b2=n-i*r-j*g; if(b2<0)break; if(b2%b==0){ //cerr<<i*r<<" "<<j*g<<" "<<b2<<endl; ans++; } } } cout<<ans<<endl; }*/ /*int main(){ int n; cin>>n; vector<int> vec(n); vec_input(vec); sort(vec.rbegin(),vec.rend()); vector<int> time(2,0); rep(i,n){ sort(all(time)); time[0]+=vec[i]; } sort(all(time)); cout<<time[1]<<endl; }*/ /*int main(){ long long int ans,a,b,c,d; cin>>a>>b>>c>>d; ans=b-a+1; long long int e=0; e+=(b/c)-(a/c); if(a%c==0)e++; e+=(b/d)-(a/d); if(a%d==0)e++; long long int f=c*d/__gcd(c,d); e-=(b/f)-(a/f); if(a%(f)==0)e--; cout<<ans-e<<endl; }*/ /*int main(){ string s; cin>>s; int ans=1; rep(i,s.length()){ if(s[i]!='4'&&s[i]!='7'){ ans=0; break; } } int n=stoi(s); int d=1,a,digit,counter=0; for(int i=4;i<=n;i++){ if(n%i==0){ d=1; digit=intlog(i)+1; cerr<<digit<<endl; counter=0; for(int j=0;j<digit;j++){ a=(i/d)%10; d*=10; if(a==4||a==7)counter++; } if(counter==digit){ ans=1; break; } } } YN(ans); }*/ /*int main(){ double p; cin>>p; //0.5=p*n; double ans=p/(1-p); printf("%.8lf\n",ans); }*/ /*int main(){ ll n; cin>>n; ll maxv=n,i=0; while(n!=1){ i++; if(n%2==0)n/=2; else n=3*n+1; if(n>maxv){ maxv=n; } } cout<<i<<endl<<maxv<<endl; }*/ /*int main(){ struct point{int x,y,z;}; int n; cin>>n; point input,sum; sum.x=0; sum.y=0; sum.z=0; rep(i,n){ cin>>input.x>>input.y>>input.z; sum.x+=input.x; sum.y+=input.y; sum.z+=input.z; } YN(sum.x==0&&sum.y==0&&sum.z==0); }*/ /*int main(){ ll n,m,ans; cin>>n>>m; if(n==1||m==1){ if(n==1&&m==1)ans=1; else if(n==1)ans=m-2; else if(m==1)ans=n-2; }else if(n==2||m==2){ ans=0; }else{ ans=(m-2)*(n-2); } cout<<ans<<endl; }*/ /*int main(){ int a,b,odd=0,even=0,ans=0; rep(i,3){ cin>>a>>b; if(a%2==1)odd++; } if(odd%2==0)ans=1; cout<<(ans?":-)":":-(")<<endl; }*/ /*int main(){ string s; cin>>s; set<char> set; rep(i,s.length()){ set.insert(s[i]); } cout<<(set.size()%2==0?"CHAT WITH HER!":"IGNORE HIM!")<<endl; }*/ /*int main(){ int n,k; cin>>n>>k; vector<int> vec(n); vector<double> p(n); rep(i,n){ cin>>vec[i]; p[i]=(double)series_sum(vec[i])/vec[i]; } double ans=0,value=0; rep(i,n){ if(i<=k-1){ value+=p[i]; ans=value; }else{ value+=p[i]-p[i-k]; ans=max(ans,value); } } printf("%.8lf\n",ans); }*/ /*int main(){ int n; cin>>n; printf("%.8lf\n",(double)1/n); }*/ /*int main(){ int n; cin>>n; string s; cin>>s; ll ans=0; rep(i,n-1){ if(s[i]==s[i+1])ans++; } cout<<ans<<endl; }*/ /*int main(){ unordered_map<ll,ll> map; unordered_set<ll> set; ll n; cin>>n; vector<ll> vec(n); rep(i,n){ cin>>vec[i]; if(set.count(vec[i])){ map[vec[i]]++; }else{ set.insert(vec[i]); map[vec[i]]=1; } } ll ans=0; for(auto it=set.begin();it!=set.end();it++){ ans+=(ll)(map[*it]*(map[*it]-1))/2; } rep(i,n){ cout<<ans-map[vec[i]]+1<<endl; } }*/ long long int series_sum(long long int n){ long long int ans=0; for(long long int i=1;i<=n;i++){ ans+=i; } return ans; } long long int combination(long long int a,long long int b){ queue<long long int> bunsi,bunbo; long long int ans=1; b=min(b,a-b); for(int i=0;i<b;i++){ bunsi.push(a-i); if(b-i>=2)bunbo.push(b-i); } while(bunsi.size()!=0||bunbo.size()!=0){ ans*=bunsi.front(); bunsi.pop(); if(ans%bunbo.front()==0){ ans/=bunbo.front(); bunbo.pop(); } } return ans; } /*int main(){ int a,b,m; cin>>a>>b>>m; vector<int> fri(a),ran(b); con_input(fri); con_input(ran); int x,y,c,minv; rep(i,m){ cin>>x>>y>>c; if(i==0)minv=fri[x-1]+ran[y-1]-c; else{ minv=min(minv,fri[x-1]+ran[y-1]-c); } } sort(all(fri)); sort(all(ran)); minv=min(minv,fri[0]+ran[0]); cout<<minv<<endl; }*/ /*int main(){ ll h; cin>>h; ll ans=0,d=1; while(h>=1){ h/=2; ans+=d; d*=2; } cout<<ans<<endl; }*/ /*int main(){ int h,w,n; cin>>h>>w>>n; cout<<(int)floor((n+max(h,w)-1)/max(h,w))<<endl; }*/ /*int main(){ int a,b; cin>>a>>b; cout<<(a*b==15?"*":a+b==15?"+":"x")<<endl; }*/ /*int main(){ int n,d=0,x; cin>>n; vector<pair<string,int>> vec(n); string s,t; rep(i,n){ cin>>t>>x; vec[i]=make_pair(t,x); } cin>>s; int ans=0; rep(i,n){ if(d==1){ ans+=vec[i].second; } if(vec[i].first==s){ d=1; } } cout<<ans<<endl; }*/ /*int main(){ long long int a,b; cin>>a>>b; cout<<a*b/__gcd(a,b)<<endl; }*/ /*int main(){ int x,n,j=0; int ans=0; cin>>n; rep(i,n){ cin>>x; if(x-1!=j){ ans++; }else{ j++; } } cout<<(ans==n?-1:ans)<<endl; }*/ /*int main(){ int m1,d1,m2,d2; cin>>m1>>d1>>m2>>d2; cout<<(m1!=m2?1:0)<<endl; }*/ /*int main(){ string s; string str; cin>>s; int ans=0,j; rep(i,s.length()){ if(i==0){ str=s.substr(0,1); ans++; }else{ j=1; if(i==s.length()-1&&s.substr(i,j)==str)break; while(s.substr(i,j)==str){ j++; } str=s.substr(i,j); i+=j-1; ans++; } } cout<<ans<<endl; }*/ /*int main(){ ll n,a,b,d1,d2; cin>>n>>a>>b; ll ans; if((b-a)%2==0)ans=(b-a)/2; else{ d1=a-1; d2=n-b; ans=min(d1,d2)+1+(b-a-1)/2; } cout<<ans<<endl; }*/ /*int main(){ int n,ans=1,j; cin>>n; vector<int> vec(n); vector<bool> vec2(n,true); con_input(vec); rep(i,n-1){ if(vec[i]-vec[i+1]>=2){ ans=0; break; } if(vec[i]-vec[i+1]==1){ vec[i]--; vec2[i]=false; j=i; while(j>=1&&vec[j-1]>vec[j]){ if(vec2[j-1]){ vec[j-1]--; vec2[j-1]=false; j--; }else{ ans=0; break; } } } if(ans==0)break; } cout<<(ans?"Yes":"No")<<endl; }*/ /*int main(){ string s; cin>>s; char c='2'; int counter=0,ans=0; rep(i,s.length()){ if(s[i]!=c){ counter=1; c=s[i]; }else{ counter++; if(counter>=7){ ans=1; break; } } } cout<<(ans?"YES":"NO")<<endl; }*/ /*int main(){ char s[100]; int ans=1,a=0; fgets(s, 100, stdin); for(int i=0;s[i]!='\n';i++){ if(i%2==0&&!(s[i]>='a'&&s[i]<='z')){ ans=0; break; } if(i%2==1&&s[i]!=' '){ ans=0; break; } } cout<<(ans?"Yes":"No")<<endl; }*/ template <typename T> T digitsum(T n){ string s=to_string(n); T sum=0; T d=1; for(T e=0;e<s.length();e++){ sum+=(n/d)%10;d*=10; } return sum; } template <typename T> bool isPrime(T n){ if(n<=1)return false; if(n==2)return true; if(n%2==0)return false; for(T q=3;q*q<=n;q+=2){ if(n%q==0)return false; } return true; } template <typename T> vector<pair<T, T>> prime_factor(T n) { vector<pair<T, T>> ret; if(n%2==0){ T tmp = 0; while (n % 2 == 0) { tmp++; n /= 2; } ret.push_back(make_pair(2, tmp)); } for (T i = 3; i*i <= n; i+=2) { if(n%i==0){ T tmp = 0; while (n % i == 0) { tmp++; n /= i; } ret.push_back(make_pair( i, tmp)); } } if (n != 1) ret.push_back(make_pair(n, 1)); return ret; } long long int intpow(long long int x,long long int n){ long long int ans=1; for(int i=0;i<n;i++){ ans*=x; } return ans; } template <typename T>T intlog(T x){ string a=to_string(x); return a.length()-1; }