Submission #412399

# Submission time Handle Problem Language Result Execution time Memory
412399 2021-05-26T20:02:59 Z nxteru Cup of Jamshid (IOI17_cup) C++14
0 / 100
2 ms 204 KB
#include "cup.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> find_cup() {
    int sx=-500000000,sy=-500000000;
    int p=ask_shahrasb(sx,sy);
    int x,y;
    for(int i=0;i<29;i++){
        if((p^ask_shahrasb(sx,sy-(1<<i)))>>(i+1)&1)y+=(1<<i);
    }
    int gx=sx,gy=sy;
    if(gy+y-(1<<29)>=-1000000000){
        gy+=y;
        int q=ask_shahrasb(gx,gy);
        if((q^ask_shahrasb(gx,gy-(1<<29)))>>(29+1)&1)y+=(1<<29);
    }else{
        y+=(1<<29);
        gy+=y;
        int q=ask_shahrasb(gx,gy);
        if((q^ask_shahrasb(gx,gy+(1<<29)))>>(29+1)&1)y-=(1<<29);
    }
    vector<int>ans;
    x=p^y;
    ans.push_back(sx+x);
    ans.push_back(sy+y);
    return ans;
}

Compilation message

cup.cpp: In function 'std::vector<int> find_cup()':
cup.cpp:9:53: warning: 'y' may be used uninitialized in this function [-Wmaybe-uninitialized]
    9 |         if((p^ask_shahrasb(sx,sy-(1<<i)))>>(i+1)&1)y+=(1<<i);
      |                                                    ~^~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 204 KB wrong cup location