Submission #931627

#TimeUsernameProblemLanguageResultExecution timeMemory
931627PieArmyExam (eJOI20_exam)C++17
12 / 100
17 ms3272 KiB
typedef long long ll; ll pie(ll army){return (1ll<<army);} #include <bits/stdc++.h> #define fr first #define sc second #define pb push_back #define endl '\n'; #define mid ((left+right)>>1) const ll inf=2000000000000000005; const int sonsuz=2000000005; using namespace std; ll fpow(ll x,ll y,ll m=0){if(y<0){cout<<"powError";return -1;}if(m)x%=m;ll res=1;while(y>0){if(y&1)res*=x;x*=x;if(m){x%=m;res%=m;}y>>=1;}return res;} void code(){ int n;cin>>n; int A[n+1],B[n+1]; for(int i=1;i<=n;i++) cin>>A[i]; for(int i=1;i<=n;i++){ cin>>B[i]; } bool dp[n+1];for(bool &x:dp)x=false; bool cur=false; for(int i=1;i<=n;i++){ if(A[i]==B[1])cur=true; if(A[i]>B[1])cur=false; dp[i]|=cur; } cur=false; for(int i=n;i;i--){ if(A[i]==B[1])cur=true; if(A[i]>B[1])cur=false; dp[i]|=cur; } int ans=0; for(int i=1;i<=n;i++) if(dp[i]) ans++; cout<<ans; } int main(){ ios_base::sync_with_stdio(false);cin.tie(NULL); bool usaco=0;if(usaco){freopen(".in","r",stdin);freopen(".out","w",stdout);} int t=1; if(!t)cin>>t; while(t--){code();cout<<endl;} return 0; }

Compilation message (stderr)

exam.cpp: In function 'int main()':
exam.cpp:44:35: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   44 |     bool usaco=0;if(usaco){freopen(".in","r",stdin);freopen(".out","w",stdout);}
      |                            ~~~~~~~^~~~~~~~~~~~~~~~~
exam.cpp:44:60: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   44 |     bool usaco=0;if(usaco){freopen(".in","r",stdin);freopen(".out","w",stdout);}
      |                                                     ~~~~~~~^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...