제출 #1326434

#제출 시각아이디문제언어결과실행 시간메모리
1326434lopkusFish 2 (JOI22_fish2)C++20
0 / 100
7 ms568 KiB
#include <bits/stdc++.h>+ signed main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; std::cin >> n; std::vector<int> a(n + 1); for(int i = 1; i <= n; i++) { std::cin >> a[i]; } int q; std::cin >> q; while(q--) { int type; std::cin >> type; if(type == 1) { int pos, x; std::cin >> pos >> x; a[pos] = x; } else { int L, R; std::cin >> L >> R; int ans = 0; for(int i = L; i <= R; i++) { int l = i - 1, r = i + 1; int val = a[i]; while(l >= L || r <= R) { if(l >= L && a[l] <= val) { val += a[l--]; continue; } if(r <= R && a[r] <= val) { val += a[r++]; continue; } break; } if(l < L && r > R) { ans += 1; } } std::cout << ans << "\n"; } } }

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

fish2.cpp:1:25: warning: extra tokens at end of #include directive
    1 | #include <bits/stdc++.h>+
      |                         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...