제출 #1102250

#제출 시각아이디문제언어결과실행 시간메모리
1102250bvv23Geppetto (COCI15_geppetto)C++17
80 / 80
302 ms504 KiB
// Ahmadov orz
/// successful failure
#include <bits/stdc++.h>
/// #include <ext/pb_ds/assoc_container.hpp>
using namespace std;
/// using namespace __gnu_pbds;
#define int long long
#define pb push_back
#define pii pair<int, int>
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define drop(x) cout<<x<<endl;return
// template <class T>
// using isTree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

/// sometimes you gotta think simple
struct custom_hash {
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        x ^= FIXED_RANDOM;
        return x ^ (x >> 16);
    }
};
const int N = 20 + 7;
void failure()
{
    int n, m;
    cin >> n >> m;
    unordered_map <int,bool> mp[N];
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            mp[i][j] = 1;
        }
    }
    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        mp[x][y] = 0;
        mp[y][x] = 0;
    }
    int ans = 0;
    vector <int> lst;
    for (int mask = 0; mask < (1<<n); mask++) {
        bool check = 1;
        for (int i = 0; i < n; i++) {
            if (mask & (1<<i)) {
                lst.pb(i + 1);
            }
        }
        // eger indiki subsetde ele bir pair varki baddi onda alinmir
        for (int i = 0; i < lst.size(); i++) {
            for (int j = i + 1; j < lst.size(); j++) {
                int x = lst[i];
                int y = lst[j];
                if (mp[x][y] == 0) {
                    check = 0;
                    break;
                }
            }
        }
        ans += (check == 1);
        lst.clear();
    }
    drop(ans);
}
signed main() { 
    ios_base::sync_with_stdio(0); 
    cin.tie(NULL);                
    cout.tie(NULL);
    int tt = 1;
    //cin >> tt;
    while (tt--)
    {
        failure();
    }
}

컴파일 시 표준 에러 (stderr) 메시지

geppetto.cpp: In function 'void failure()':
geppetto.cpp:52:27: 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]
   52 |         for (int i = 0; i < lst.size(); i++) {
      |                         ~~^~~~~~~~~~~~
geppetto.cpp:53:35: 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]
   53 |             for (int j = i + 1; j < lst.size(); j++) {
      |                                 ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...