제출 #301640

#제출 시각아이디문제언어결과실행 시간메모리
301640kevinsogoFinding Routers (IOI20_routers)C++17
100 / 100
2 ms512 KiB
#include "routers.h" #include <bits/stdc++.h> using namespace std; vector<int> maxs; void solve(int p1, int p2, int i1, int i2) { if (i1 == i2 || p2 - p1 <= 1) return; int pm = p1 + p2 >> 1; int im = use_detector(pm); maxs[im] = max(maxs[im], pm); solve(p1, pm, i1, im); solve(pm, p2, im, i2); } vector<int> find_routers(int l, int n, int q) { maxs = vector<int>(n, 1); solve(1, l, 0, n - 1); vector<int> ans(n); for (int i = 0; i < n - 1; i++) { ans[i + 1] = 2 * maxs[i] - ans[i]; } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

routers.cpp: In function 'void solve(int, int, int, int)':
routers.cpp:8:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
    8 |     int pm = p1 + p2 >> 1;
      |              ~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...