제출 #469601

#제출 시각아이디문제언어결과실행 시간메모리
469601ItamarFountain (eJOI20_fountain)C++14
0 / 100
1576 ms1596 KiB
#include <vector> #include <algorithm> using namespace std; #include <iostream> vector<int> pre; int n; int lower_bo(int l, int r, int val) { int mid = (l + r) / 2; if (pre[mid] < val && (mid == n || pre[mid+1] >= val) ) { return mid+1; } if (pre[mid] < val) { return lower_bo(mid + 1, r, val); } if (pre[mid] > val) { return lower_bo(l, mid - 1, val); } } int main() { int q; cin >> n >> q; vector<int> d; vector<int> c; pre.push_back(0); for (int i = 1; i < n+1; i++) { int x, y; cin >> x >> y; d.push_back(x); pre.push_back(y+pre[i-1]); c.push_back(y); } for (int i = 0; i < q; i++) { int r, v; cin >> r >> v; r; int it = r; while (v > c[r]) { if (r == n) { it = 0; break; } r++; v -= c[r]; } //int it = lower_bo(1, n, v + pre[r - 1]); cout << it << endl; } }

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

fountain.cpp: In function 'int main()':
fountain.cpp:38:9: warning: statement has no effect [-Wunused-value]
   38 |         r;
      |         ^
fountain.cpp: In function 'int lower_bo(int, int, int)':
fountain.cpp:19:1: warning: control reaches end of non-void function [-Wreturn-type]
   19 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...