# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
826921 | 2023-08-16T06:44:58 Z | Hanksburger | Festivals in JOI Kingdom 2 (JOI23_festival2) | C++17 | 9000 ms | 212 KB |
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > vec, vec2; int a[40005]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, p, ans=0; cin >> n >> p; for (int i=1; i<=n*2; i++) a[i]=i; do { int ok=1; for (int i=1; i<n; i++) { if (a[i]>a[i+1]) { ok=0; break; } } for (int i=1; i<=n; i++) { if (a[i]>a[i+n]) { ok=0; break; } } if (ok) { vec.clear(); vec2.clear(); for (int i=1; i<=n; i++) { vec.push_back({a[i], a[i+n]}); vec2.push_back({a[i+n], a[i]}); } sort(vec.begin(), vec.end()); sort(vec2.begin(), vec2.end()); int res=0, res2=0, pre=0, pre2=0; for (int i=0; i<vec.size(); i++) { if (pre<vec[i].first) { pre=vec[i].second; res++; } } for (int i=0; i<vec2.size(); i++) { if (pre2<vec2[i].second) { pre2=vec2[i].first; res2++; } } if (res<res2) ans++; } } while (next_permutation(a+1, a+n*2+1)); cout << ans%p; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 24 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 24 ms | 212 KB | Output is correct |
8 | Execution timed out | 9091 ms | 212 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 24 ms | 212 KB | Output is correct |
8 | Execution timed out | 9091 ms | 212 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 24 ms | 212 KB | Output is correct |
8 | Execution timed out | 9091 ms | 212 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 24 ms | 212 KB | Output is correct |
8 | Execution timed out | 9091 ms | 212 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 24 ms | 212 KB | Output is correct |
8 | Execution timed out | 9091 ms | 212 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |