# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
895738 | 2023-12-30T17:55:53 Z | Aiperiii | Festivals in JOI Kingdom 2 (JOI23_festival2) | C++14 | 9000 ms | 452 KB |
#include <bits/stdc++.h> #define int long long #define all(x) x.begin(),x.end() #define ff first #define ss second #define pb push_back using namespace std; signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); int n,p; cin>>n>>p; int ans=0; for(int i=0;i<(1<<(n*2));i++){ vector <int> v1,v2; for(int j=0;j<n*2;j++){ if((i & (1<<j))!=0)v1.pb(j); else v2.pb(j); } if(v1.size()==v2.size()){ do{ bool flag=true; for(int j=0;j<n;j++){ if(v1[j]>v2[j])flag=false; } if(flag){ int cnt1=1; int l=v1[0]; int r=v2[0]; for(int j=1;j<n;j++){ if(v1[j]>r){ cnt1++; l=v1[j]; r=v2[j]; } } int cnt2=0; for(int x=0;x<(1<<n);x++){ vector <pair <int,int> > d; bool can=1; for(int y=0;y<n;y++){ if((x & (1<<y))!=0){ d.pb({v1[y],v2[y]}); } } for(int j=1;j<d.size();j++){ if(d[j].ff<d[j-1].ss){ can=0;break; } } if(can)cnt2=max((int)d.size(),cnt2); } if(cnt1<cnt2){ ans++;ans%=p; } } }while(next_permutation(all(v2))); } } cout<<ans<<"\n"; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 452 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 2 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 452 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 2 ms | 348 KB | Output is correct |
8 | Execution timed out | 9050 ms | 348 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 452 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 2 ms | 348 KB | Output is correct |
8 | Execution timed out | 9050 ms | 348 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 452 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 2 ms | 348 KB | Output is correct |
8 | Execution timed out | 9050 ms | 348 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 452 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 2 ms | 348 KB | Output is correct |
8 | Execution timed out | 9050 ms | 348 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 452 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 2 ms | 348 KB | Output is correct |
8 | Execution timed out | 9050 ms | 348 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |