답안 #228025

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
228025 2020-04-29T14:43:59 Z jzh Lost in the cycle (IOI19_cycle) C++14
33 / 100
5 ms 384 KB
#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

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);
     ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Incorrect 4 ms 256 KB Too many queries.
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 4 ms 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Incorrect 4 ms 256 KB Too many queries.
3 Halted 0 ms 0 KB -