# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
54562 | 2018-07-04T05:55:09 Z | win11905 | 곤돌라 (IOI14_gondola) | C++11 | 23 ms | 964 KB |
#include <bits/stdc++.h> #define long long long #include "gondola.h" using namespace std; const long M = 1e9+9; int valid(int n, int inputSeq[]) { for(int i = 0, st = -n-1; i < n; ++i, ++st) { if(st == n+1) st = 1; if(inputSeq[i] <= n) { if(st < 0) st = inputSeq[i]; else if(st != inputSeq[i]) return 0; } } return 1; } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]) { int sz = 0, mx = *max_element(gondolaSeq, gondolaSeq + n); set<int> S; for(int i = 0; i < n; ++i) S.emplace(gondolaSeq[i]); for(int i = n+1; i <= sz; ++i) if(S.find(i) == S.end()) replacementSeq[sz++] = i; return sz; } //---------------------- int powMod(int a, int b) { if(!a) return a; int val = 1; while(b) { if(b & 1) val = (1ll * val * a) % M; a = (1ll * a * a) % M; b >>= 1; } return val; } int countReplacement(int n, int inputSeq[]) { if(!valid(n, inputSeq)) return 0; vector<int> V; V.emplace_back(n); for(int i = 0; i < n; ++i) if(inputSeq[i] > n) V.emplace_back(inputSeq[i]); if(V.size() == 1) return 1; long ans = 0; int s = V.size(); sort(V.begin(), V.end()); for(int i = 1; i < s; ++i) ans = (ans + powMod(s - i, V[i] - V[i-1] - 1)) % M; return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 436 KB | Output is correct |
4 | Correct | 2 ms | 472 KB | Output is correct |
5 | Correct | 2 ms | 536 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 548 KB | Output is correct |
2 | Correct | 2 ms | 560 KB | Output is correct |
3 | Correct | 2 ms | 564 KB | Output is correct |
4 | Correct | 2 ms | 568 KB | Output is correct |
5 | Correct | 2 ms | 572 KB | Output is correct |
6 | Correct | 7 ms | 704 KB | Output is correct |
7 | Correct | 13 ms | 936 KB | Output is correct |
8 | Correct | 11 ms | 936 KB | Output is correct |
9 | Correct | 5 ms | 936 KB | Output is correct |
10 | Correct | 23 ms | 936 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 936 KB | Output is correct |
2 | Correct | 2 ms | 936 KB | Output is correct |
3 | Correct | 2 ms | 936 KB | Output is correct |
4 | Correct | 2 ms | 936 KB | Output is correct |
5 | Correct | 2 ms | 936 KB | Output is correct |
6 | Correct | 6 ms | 936 KB | Output is correct |
7 | Correct | 17 ms | 936 KB | Output is correct |
8 | Correct | 11 ms | 960 KB | Output is correct |
9 | Correct | 5 ms | 960 KB | Output is correct |
10 | Correct | 12 ms | 964 KB | Output is correct |
11 | Incorrect | 2 ms | 964 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 964 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 964 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 964 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 964 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 964 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 964 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 964 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |