Submission #228025

#TimeUsernameProblemLanguageResultExecution timeMemory
228025jzhLost in the cycle (IOI19_cycle)C++14
33 / 100
5 ms384 KiB
#include "cycle.h"
#include <bits/stdc++.h>
using namespace std;
void escape (int n){
    int x = n, y;
    if (jump(0)){
        x = n/2;
    }
    else {
        x = n/2;
        x *= -1;
    }
    bool b;
    while (abs(x)>0){
        y = x;
        if (y<0)y+=n;
        y%=n;
        //cout<<x<<' '<<y<<'\n';
        if (jump(y)){
            x = abs(x) + x%2;
            //cout<<"True\n";
            b = true;
            x = x/2;
        }
        else {
            x = -1*abs(x);
            //cout<<"False\n";
            b = false;
            x = x/2 - abs(x)%2;
        }
        //cout<<ans<<'\n';
        //x = x/2 + x%2;
    }
    if (!b)jump(n-1);
}

Compilation message (stderr)

cycle.cpp: In function 'void escape(int)':
cycle.cpp:34:5: warning: 'b' may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (!b)jump(n-1);
     ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...