# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
71959 | 2018-08-26T04:04:34 Z | 30분만 즐기고 갈게요~(#2266, kajebiii) | Easy Data Structure Problem (FXCUP3_easy) | C++17 | 2 ms | 332 KB |
#include <bits/stdc++.h> using namespace std; #define SZ(v) ((int)(v).size()) #define ALL(v) (v).begin(),(v).end() #define one first #define two second typedef long long ll; typedef pair<int, int> pi; const int INF = 0x3f2f1f0f; const ll LINF = 1ll * INF * INF; struct IDX { int P; vector<int> Val; IDX(int N) { for(P=1; P<N; P<<=1); Val = vector<int>(P*2, INF); } void update(int v, int k) { Val[v += P] = k; while(v/=2) Val[v] = min(Val[v*2], Val[v*2+1]); } int getMin(int a, int b) { a+=P; b+=P; int result = INF; while(a <= b) { if(a%2 == 1) result = min(result, Val[a++]); if(b%2 == 0) result = min(result, Val[b--]); a>>=1;b>>=1; } return result; } }; int N, Q; int main() { cin >> N >> Q; IDX idx = IDX(N); for(int i=0; i<N; i++) { int x; scanf("%d", &x); idx.update(i, x); } for(int q=0; q<Q; q++) { int l, r; scanf("%d%d", &l, &r); l--; r--; printf("%d\n", idx.getMin(l, r)); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 332 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 332 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |