# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
257910 | 2020-08-05T04:12:04 Z | 반딧불(#5055) | Employment (JOI16_employment) | C++17 | 341 ms | 17880 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n, q; int arr[200002]; vector<pair<int, int> > vec; map<int, int> mp; int cnt; bool chk[200002]; int main(){ scanf("%d %d", &n, &q); for(int i=1; i<=n; i++){ scanf("%d", &arr[i]); vec.push_back(make_pair(arr[i], i)); } sort(vec.begin(), vec.end()); mp[1000000001] = 0; for(int i=n-1; i>=0; i--){ int tx = vec[i].second, ty = vec[i].first; if(!chk[tx-1] && !chk[tx+1]) cnt++; else if(chk[tx-1] && chk[tx+1]) cnt--; chk[tx] = 1; mp[ty] = cnt; } while(q--){ int qd; scanf("%d %d", &qd, &qd); auto it = mp.lower_bound(qd); printf("%d\n", it->second); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 512 KB | Output is correct |
3 | Correct | 2 ms | 512 KB | Output is correct |
4 | Correct | 16 ms | 1152 KB | Output is correct |
5 | Correct | 33 ms | 2680 KB | Output is correct |
6 | Correct | 53 ms | 3044 KB | Output is correct |
7 | Correct | 87 ms | 7020 KB | Output is correct |
8 | Correct | 115 ms | 8168 KB | Output is correct |
9 | Correct | 211 ms | 11624 KB | Output is correct |
10 | Correct | 200 ms | 15344 KB | Output is correct |
11 | Correct | 256 ms | 15204 KB | Output is correct |
12 | Correct | 341 ms | 17204 KB | Output is correct |
13 | Correct | 321 ms | 17508 KB | Output is correct |
14 | Correct | 293 ms | 16996 KB | Output is correct |
15 | Correct | 292 ms | 17452 KB | Output is correct |
16 | Correct | 328 ms | 17636 KB | Output is correct |
17 | Correct | 327 ms | 17636 KB | Output is correct |
18 | Correct | 337 ms | 17764 KB | Output is correct |
19 | Correct | 291 ms | 17764 KB | Output is correct |
20 | Correct | 302 ms | 17880 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |