Submission #364111

#TimeUsernameProblemLanguageResultExecution timeMemory
364111ahmedfouadnewCONSUL (info1cup19_consul)C++17
19 / 100
848 ms380 KiB
#include "grader.h" //#include "grader.cpp" #include<bits/stdc++.h> using namespace std; #define pb push_back void solve(int n) { vector<int>v; for(int i=1;i<=n;i++) { v.pb(kth(i)); } sort(v.begin(),v.end()); int cur=0; for(int i=0;i<v.size();i++) { if(!i) { cur=1; } else { if(v[i]==v[i-1]) { cur++; } else cur=1; } if(cur>n/3) { say_answer(v[i]); break; } } }

Compilation message (stderr)

consul.cpp: In function 'void solve(int)':
consul.cpp:15:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for(int i=0;i<v.size();i++)
      |                 ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...