답안 #946440

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
946440 2024-03-14T16:30:51 Z Aiperiii Amusement Park (CEOI19_amusementpark) C++14
컴파일 오류
0 ms 0 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++;
                g[v[i]].pb(u[i]);
            }
            else g[u[i]].pb(v[i]);
        }
        
        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:33:17: error: 'g' was not declared in this scope
   33 |                 g[v[i]].pb(u[i]);
      |                 ^
amusementpark.cpp:35:18: error: 'g' was not declared in this scope
   35 |             else g[u[i]].pb(v[i]);
      |                  ^
amusementpark.cpp:40: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]
   40 |         if(x!=st.size()){
      |            ~^~~~~~~~~~~