답안 #946464

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
946464 2024-03-14T16:49:57 Z vjudge1 Amusement Park (CEOI19_amusementpark) C++17
42 / 100
3000 ms 170848 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;
const int mod=1e9+7;
signed main(){
    int n,m;
    cin>>n>>m;
    vector <int> u(m),v(m);
    for(int i=0;i<m;i++){
        cin>>u[i]>>v[i];
    }
    int ans=0;
    vector <int> ord;
    set <int> st;
    for(int i=1;i<=n;i++)ord.pb(i);
    do{
        vector <int> val_ord(n+1);
        for(int i=0;i<ord.size();i++){
            val_ord[ord[i]]=i;
        }
        int cnt=0;
        int ch=0;
        for(int i=0;i<m;i++){
            int x=val_ord[u[i]];
            int y=val_ord[v[i]];
            if(x<y){
                ch+=(1ll<<i);
                cnt++;
                
            }
        }
        
        int x=st.size();
        st.insert(ch);
        if(x!=st.size()){
            ans+=cnt;ans%=mod;
        }
    }while(next_permutation(all(ord)));
    
    cout<<ans<<"\n";
}
 
 
/*
 3 3
 1 2
 2 3
 1 3
 1 2 3
*/

Compilation message

amusementpark.cpp: In function 'int main()':
amusementpark.cpp:22:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         for(int i=0;i<ord.size();i++){
      |                     ~^~~~~~~~~~~
amusementpark.cpp:39:13: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::set<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |         if(x!=st.size()){
      |            ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 436 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 432 KB Output is correct
16 Correct 1 ms 432 KB Output is correct
17 Correct 0 ms 424 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 404 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 436 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 432 KB Output is correct
16 Correct 1 ms 432 KB Output is correct
17 Correct 0 ms 424 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 404 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 772 KB Output is correct
29 Correct 1 ms 600 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 1 ms 600 KB Output is correct
32 Correct 2 ms 600 KB Output is correct
33 Correct 3 ms 348 KB Output is correct
34 Correct 4 ms 348 KB Output is correct
35 Correct 6 ms 604 KB Output is correct
36 Correct 6 ms 844 KB Output is correct
37 Correct 10 ms 1432 KB Output is correct
38 Correct 13 ms 2140 KB Output is correct
39 Correct 17 ms 348 KB Output is correct
40 Correct 21 ms 436 KB Output is correct
41 Correct 26 ms 348 KB Output is correct
42 Correct 31 ms 604 KB Output is correct
43 Correct 54 ms 1544 KB Output is correct
44 Correct 57 ms 2952 KB Output is correct
45 Correct 68 ms 5968 KB Output is correct
46 Correct 100 ms 10832 KB Output is correct
47 Correct 113 ms 17236 KB Output is correct
48 Correct 21 ms 344 KB Output is correct
49 Correct 33 ms 504 KB Output is correct
50 Correct 28 ms 620 KB Output is correct
51 Correct 33 ms 592 KB Output is correct
52 Correct 176 ms 416 KB Output is correct
53 Correct 220 ms 348 KB Output is correct
54 Correct 284 ms 592 KB Output is correct
55 Correct 351 ms 1688 KB Output is correct
56 Correct 507 ms 8784 KB Output is correct
57 Correct 621 ms 22676 KB Output is correct
58 Correct 801 ms 48572 KB Output is correct
59 Correct 1026 ms 94696 KB Output is correct
60 Correct 1387 ms 170848 KB Output is correct
61 Correct 203 ms 432 KB Output is correct
62 Correct 335 ms 800 KB Output is correct
63 Correct 286 ms 992 KB Output is correct
64 Correct 325 ms 1244 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 436 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 432 KB Output is correct
16 Correct 1 ms 432 KB Output is correct
17 Correct 0 ms 424 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 404 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 772 KB Output is correct
29 Correct 1 ms 600 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 1 ms 600 KB Output is correct
32 Correct 2 ms 600 KB Output is correct
33 Correct 3 ms 348 KB Output is correct
34 Correct 4 ms 348 KB Output is correct
35 Correct 6 ms 604 KB Output is correct
36 Correct 6 ms 844 KB Output is correct
37 Correct 10 ms 1432 KB Output is correct
38 Correct 13 ms 2140 KB Output is correct
39 Correct 17 ms 348 KB Output is correct
40 Correct 21 ms 436 KB Output is correct
41 Correct 26 ms 348 KB Output is correct
42 Correct 31 ms 604 KB Output is correct
43 Correct 54 ms 1544 KB Output is correct
44 Correct 57 ms 2952 KB Output is correct
45 Correct 68 ms 5968 KB Output is correct
46 Correct 100 ms 10832 KB Output is correct
47 Correct 113 ms 17236 KB Output is correct
48 Correct 21 ms 344 KB Output is correct
49 Correct 33 ms 504 KB Output is correct
50 Correct 28 ms 620 KB Output is correct
51 Correct 33 ms 592 KB Output is correct
52 Correct 176 ms 416 KB Output is correct
53 Correct 220 ms 348 KB Output is correct
54 Correct 284 ms 592 KB Output is correct
55 Correct 351 ms 1688 KB Output is correct
56 Correct 507 ms 8784 KB Output is correct
57 Correct 621 ms 22676 KB Output is correct
58 Correct 801 ms 48572 KB Output is correct
59 Correct 1026 ms 94696 KB Output is correct
60 Correct 1387 ms 170848 KB Output is correct
61 Correct 203 ms 432 KB Output is correct
62 Correct 335 ms 800 KB Output is correct
63 Correct 286 ms 992 KB Output is correct
64 Correct 325 ms 1244 KB Output is correct
65 Execution timed out 3031 ms 7636 KB Time limit exceeded
66 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 436 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 432 KB Output is correct
16 Correct 1 ms 432 KB Output is correct
17 Correct 0 ms 424 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 404 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 772 KB Output is correct
29 Correct 1 ms 600 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 1 ms 600 KB Output is correct
32 Correct 2 ms 600 KB Output is correct
33 Correct 3 ms 348 KB Output is correct
34 Correct 4 ms 348 KB Output is correct
35 Correct 6 ms 604 KB Output is correct
36 Correct 6 ms 844 KB Output is correct
37 Correct 10 ms 1432 KB Output is correct
38 Correct 13 ms 2140 KB Output is correct
39 Correct 17 ms 348 KB Output is correct
40 Correct 21 ms 436 KB Output is correct
41 Correct 26 ms 348 KB Output is correct
42 Correct 31 ms 604 KB Output is correct
43 Correct 54 ms 1544 KB Output is correct
44 Correct 57 ms 2952 KB Output is correct
45 Correct 68 ms 5968 KB Output is correct
46 Correct 100 ms 10832 KB Output is correct
47 Correct 113 ms 17236 KB Output is correct
48 Correct 21 ms 344 KB Output is correct
49 Correct 33 ms 504 KB Output is correct
50 Correct 28 ms 620 KB Output is correct
51 Correct 33 ms 592 KB Output is correct
52 Correct 176 ms 416 KB Output is correct
53 Correct 220 ms 348 KB Output is correct
54 Correct 284 ms 592 KB Output is correct
55 Correct 351 ms 1688 KB Output is correct
56 Correct 507 ms 8784 KB Output is correct
57 Correct 621 ms 22676 KB Output is correct
58 Correct 801 ms 48572 KB Output is correct
59 Correct 1026 ms 94696 KB Output is correct
60 Correct 1387 ms 170848 KB Output is correct
61 Correct 203 ms 432 KB Output is correct
62 Correct 335 ms 800 KB Output is correct
63 Correct 286 ms 992 KB Output is correct
64 Correct 325 ms 1244 KB Output is correct
65 Execution timed out 3031 ms 7636 KB Time limit exceeded
66 Halted 0 ms 0 KB -