답안 #412402

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
412402 2021-05-26T20:11:14 Z aris12345678 Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
1 ms 456 KB
#include <bits/stdc++.h>
using namespace std;

const int mxN = 515;

int query(vector<int>);

int findEgg(int n, vector<pair<int, int> > bridges) {
    int st = 1, en = n, md, ans;
    while(st <= en) {
        md = (st+en)/2;
        vector<int> left, right;
        for(int i = st; i <= md; i++)
            left.push_back(i);
        for(int i = md+1; i <= en; i++)
            right.push_back(i);
        if(query(left)) {
            if(left.size() == 1)
                ans = left[0];
            en = md-1;
        } else {
            if(right.size() == 1)
                ans = right[0];
            st = md+1;
        }
    }
    return ans;
}

Compilation message

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:27:12: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
   27 |     return ans;
      |            ^~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 328 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 440 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -