Tag: Codeforces Round #420 (Div. 2)

Codeforces Round #420 (Div. 2), problem: (E) Okabe and El Psy Kongroo Solution In C/C++

#include <stdio.h> #define m 1000000007u typedef long long unsigned llu; typedef unsigned u; u M; u X,Y,*A,*B,*C; int main() { u q,n,e,i,j,k; for(n=-1;++n<16;) { for(i=-1;++i<=n;) for(j=-1;++j<=n;) M=(i<j?j-i:i-j)<2; for(e=0;++e<64;) { for(i=-1;++i<=n;) for(j=-1;++j<=n;) for(k=-1;++k<=n;) M= ( M+ M* (llu)M )%m; } } llu x,y,z;*(A=X)=1;B=Y; for(scanf("%u%I64u",&q,&z);q--;) { scanf("%I64u%I64u%u",&x,&y,&n); if(y>z)y=z; for(x=y-x,e=0;x;x>>=1,++e)if(x&1) { for(i=-1;++i<=n;) for(B=0,j=-1;++j<=n;) B=(B+M*(llu)A)%m; C=A;A=B;B=C; } for(i=n;++i<16;)A=0; } printf("%un",*A); return 0; }

Codeforces Round #420 (Div. 2), problem: (D) Okabe and City Solution In C/C++

#include<iostream> #include<cstdio> #include<cstring> #include<queue> #include<cmath> using namespace std; const int maxn=1e4+5; const int inf=0x7f7f7f7f; int x,y,dis; bool vis; int k,n,m; int bfs() { queue<int>q; q.push(1); //memset //for(int i=1;i<=n;i++)dis=inf; memset(dis,0x7f,sizeof dis); dis=0; vis=true; while(!q.empty()) { int u; u=q.front();q.pop(); for(int i=1;i<=k;i++) { if(u==i)continue; int w=inf; int l1=abs(x-x); int...

Codeforces Round #420 (Div. 2), problem: (C) Okabe and Boxes Solution In C/C++

#include <cstdio> using namespace std; int n,s,top; int main() { int i,j,ans=0; char op; scanf("%d",&n); for(i=j=1;i<=2*n;++i) { scanf("%s",op); if(op=='a') scanf("%d",&s); else { if(top) { if(s==j) --top; else top=0,++ans; } ++ j; } } printf("%dn",ans); }

Codeforces Round #420 (Div. 2), problem: (A) Okabe and Future Gadget Laboratory Solution In C/C++

#include <bits/stdc++.h> using namespace std; int main() { int n,a,i,j,k,l,f; cin>>n; for(i=0;i<n;i++) for(j=0;j<n;j++) cin>>a; for(i=0;i<n;i++) for(j=0;j<n;j++) { f=0; for(k=0;k<n;k++) for(l=0;l<n;l++) if(a==a+a||a==1) f=1; if(!f) { cout<<"Non"; return 0; } } cout<<"Yesn"; return 0; }

Want to stay up to date with the latest news?

We would love to hear from you! Please fill in your details and we will stay in touch. It's that simple!