답안 #991024

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
991024 2024-06-01T04:53:31 Z Pacybwoah Festivals in JOI Kingdom 2 (JOI23_festival2) C++17
5 / 100
9000 ms 348 KB
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
int n;
ll mod;
int main(){
    cin >> n >> mod;
    ll ans = 0;
    for(int i = 0; i < (1 << (2 * n)); i++){
        vector<int> a, b;
        for(int j = 0; j < 2 * n; j++){
            if(i & (1 << j)) a.push_back(j);
            else b.push_back(j);
        }
        if(a.size() != b.size()) continue;
        do{
            vector<pair<int, int>> vec;
            bool flag = 1;
            for(int k = 0; k < n; k++){
                if(a[k] > b[k]){
                    flag = 0;
                    break;
                }
                vec.push_back(make_pair(a[k], b[k]));
            }
            if(!flag) continue;
            int gre = 0, opt = 0;
            int now = -1;
            for(auto &[l, r]: vec){
                if(now < l){
                    gre++;
                    now = r;
                }
            }
            now = -1;
            for(auto &[l, r]: vec){
                if(now < l){
                    opt++;
                    now = r;
                }
                else now = min(now, r);
            }
            if(gre != opt) ans++;
            //cout << gre << " " << opt << "\n";

        }while(next_permutation(b.begin(), b.end()));
    }
    cout << ans % mod << "\n";
}
// g++ -std=gnu++20 pB.cpp -o run -Wall -Wextra -fsanitize=undefined -fsanitize=address
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 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 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 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 9083 ms 348 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 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 9083 ms 348 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 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 9083 ms 348 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 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 9083 ms 348 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 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 9083 ms 348 KB Time limit exceeded
9 Halted 0 ms 0 KB -