Submission #1313280

#TimeUsernameProblemLanguageResultExecution timeMemory
1313280neonglitchCONSUL (info1cup19_consul)C++20
Compilation error
0 ms0 KiB
#include "grader.h" void solve(int n) { /// insert your code /// for example int a[n+2]={0}; for(int i=1;i<=n;i++)a[i]=-1; int lm=n/3; srand(time(0)); for(int ip=0;ip<30;ip++) { int j=rand()%n + 1; while(a[j]!=-1) { j=rand()%n+1; } a[j]=kth(j); if(cnt(a[j])>lm) { say_answer(a[j]); return; } } say_answer(-1); }

Compilation message (stderr)

consul.cpp: In function 'void solve(int)':
consul.cpp:10:15: error: 'time' was not declared in this scope
   10 |         srand(time(0));
      |               ^~~~
consul.cpp:2:1: note: 'time' is defined in header '<ctime>'; did you forget to '#include <ctime>'?
    1 | #include "grader.h"
  +++ |+#include <ctime>
    2 | 
consul.cpp:10:9: error: 'srand' was not declared in this scope
   10 |         srand(time(0));
      |         ^~~~~
consul.cpp:13:23: error: 'rand' was not declared in this scope
   13 |                 int j=rand()%n + 1;
      |                       ^~~~