Submission #206709

#TimeUsernameProblemLanguageResultExecution timeMemory
206709mayhoubsalehCONSUL (info1cup19_consul)C++14
Compilation error
0 ms0 KiB
#include "grader.h" #include <bits/stdc++.h> using namespace std; void solve(int n) { bool vis[1010]; memset(vis,0,sizeof vis); int x=min(n-1,59); map<int,int>res; while(x--){ int id=rand()%n+1; if(vis[id])}{x++;continue;} vis[id]=1; int val=kth(id); res[val]++; if(res[val]>n/3){ say_answer(val); return; } } pair<int,int>mx={-1,-1}; for(auto x:res){ if(x.second>mx.second){ mx=x; } } if(cnt(mx.first)>n/3){ say_answer(mx.second); return ; } say_answer(-1); }

Compilation message (stderr)

consul.cpp: In function 'void solve(int)':
consul.cpp:12:20: error: expected primary-expression before '}' token
         if(vis[id])}{x++;continue;}
                    ^
consul.cpp:12:26: error: continue statement not within a loop
         if(vis[id])}{x++;continue;}
                          ^~~~~~~~
consul.cpp:13:13: error: 'id' was not declared in this scope
         vis[id]=1;
             ^~
consul.cpp: At global scope:
consul.cpp:23:5: error: expected unqualified-id before 'for'
     for(auto x:res){
     ^~~
consul.cpp:28:5: error: expected unqualified-id before 'if'
     if(cnt(mx.first)>n/3){
     ^~
consul.cpp:32:15: error: expected constructor, destructor, or type conversion before '(' token
     say_answer(-1);
               ^
consul.cpp:33:1: error: expected declaration before '}' token
 }
 ^