Submission #714126

# Submission time Handle Problem Language Result Execution time Memory
714126 2023-03-24T02:06:03 Z mongla Preokret (COCI18_preokret) C++17
2 / 50
2 ms 308 KB
#include<bits/stdc++.h>
#define MAX 2880
using namespace std;
int t1[MAX+5],t2[MAX+5];
int main(){
	int a,b,x;
    cin>>a; for(int i=1;i<=a;i++) cin>>x,t1[x]++;
    cin>>b; for(int i=1;i<=b;i++) cin>>x,t2[x]++;
    
    int s1=0,s2=0,exceed=0,ans=0;
    char winner='\0';
    for(int i=1;i<=MAX;i++){
        if(t1[i]) s1++;
        if(t2[i]) s2++;
        ans=s1+s2;
        
        if(i==MAX/2) cout<<ans<<'\n'; 
        
        if(s1>s2) 
            if(winner=='B')                
                exceed++;
            winner='A';

        if(s1<s2)
            if(winner=='A')
                exceed++;
            winner='B';
    }
    cout<<exceed;
    return 0;
} 

Compilation message

preokret.cpp: In function 'int main()':
preokret.cpp:19:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   19 |         if(s1>s2)
      |         ^~
preokret.cpp:22:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   22 |             winner='A';
      |             ^~~~~~
preokret.cpp:24:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   24 |         if(s1<s2)
      |         ^~
preokret.cpp:27:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   27 |             winner='B';
      |             ^~~~~~
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 212 KB Output is partially correct
2 Partially correct 1 ms 212 KB Output is partially correct
3 Partially correct 1 ms 304 KB Output is partially correct
4 Partially correct 1 ms 212 KB Output is partially correct
5 Partially correct 1 ms 212 KB Output is partially correct
6 Partially correct 1 ms 308 KB Output is partially correct
7 Partially correct 1 ms 304 KB Output is partially correct
8 Partially correct 2 ms 212 KB Output is partially correct
9 Partially correct 1 ms 212 KB Output is partially correct
10 Partially correct 1 ms 212 KB Output is partially correct