Submission #957246

# Submission time Handle Problem Language Result Execution time Memory
957246 2024-04-03T10:00:14 Z DeltaStruct Lost in the cycle (IOI19_cycle) C++17
0 / 100
1 ms 344 KB
#include "cycle.h"
#include <bits/stdc++.h>
using namespace std;
 
void escape(int n){
  if (n==2){ jump(1); return; }
  int ret = jump(n/2); if (ret==false) jump(n/2);
  int l = 0,r = n,mid,now = 0,nxt;
  while(abs(l-r)>1){
    mid+=(l+r)/2,nxt=(now+n-1)/n*n+mid,nxt=jump((nxt-now)%n),now=nxt;
    if (nxt) l = mid;
    else r = mid;
    now = nxt;
  }
  nxt=(now+n-1)/n*n+l,nxt=jump((nxt-now)%n);
}

Compilation message

cycle.cpp: In function 'void escape(int)':
cycle.cpp:10:8: warning: 'mid' may be used uninitialized in this function [-Wmaybe-uninitialized]
   10 |     mid+=(l+r)/2,nxt=(now+n-1)/n*n+mid,nxt=jump((nxt-now)%n),now=nxt;
      |     ~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Invalid argument.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Invalid argument.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Invalid argument.
2 Halted 0 ms 0 KB -