Submission #780893

#TimeUsernameProblemLanguageResultExecution timeMemory
780893AndreyCONSUL (info1cup19_consul)C++14
100 / 100
25 ms296 KiB
#include "grader.h" #include<bits/stdc++.h> using namespace std; void solve(int n) { srand(time(NULL)); vector<int> bruh(0); for(int i = 0; i < n; i++) { bruh.push_back(i+1); } int q,a,br,b; if(n <= 50) { q = 25; } else { q = 30; } for(int i = 0; i < min(n,q); i++) { a = rand()%(n-i); b = kth(bruh[a]); br = cnt(b); if(br > n/3) { say_answer(b); return; } else { for(int j = a; j < bruh.size()-1; j++) { swap(bruh[j],bruh[j+1]); } bruh.pop_back(); } } say_answer(-1); }

Compilation message (stderr)

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