Submission #613884

# Submission time Handle Problem Language Result Execution time Memory
613884 2022-07-30T12:22:39 Z Mr_Husanboy Simurgh (IOI17_simurgh) C++14
13 / 100
685 ms 468 KB
#include "simurgh.h"
#include<bits/stdc++.h>

using namespace std;
#define all(a) (a).begin(), (a).end()
#define vi vector<int>
#define ff first
#define ss second


vector<vi> g;

vector<int> find_roads(int n, vector<int> u, vector<int> v) {
//    count_common_roads(vi{0,0,0});
    int m = u.size();
    vector<int> vis(n);
    function<void(int)> dfs = [&](int i){
        vis[i] = 1;
        for(auto u : g[i]){
            if(!vis[u]) dfs(u);
        }
    };
    for(int i = 0; i <(1<<m); i++){
        vector<int> tem;
        g.assign(n,vi());
        vis.assign(n,0);
        for(int j = 0; j < m; j++){
            if(i & (1 << j)){
                tem.push_back(j);
                g[u[j]].push_back(v[j]);
                g[v[j]].push_back(u[j]);
            }
        }
        if(tem.size() != n-1) continue;
        dfs(0);
        int cnt = 0;
        for(auto u : vis) cnt += u;
        if(tem.size() == n-1 && cnt == n){
            //cout << "H " << endl;
          //  for(auto u:tem) cout << u << ' '; cout << endl;
            if(count_common_roads(tem) == n-1) return tem;
        }
    }
}

Compilation message

simurgh.cpp: In function 'std::vector<int> find_roads(int, std::vector<int>, std::vector<int>)':
simurgh.cpp:34:23: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |         if(tem.size() != n-1) continue;
      |            ~~~~~~~~~~~^~~~~~
simurgh.cpp:38:23: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   38 |         if(tem.size() == n-1 && cnt == n){
      |            ~~~~~~~~~~~^~~~~~
simurgh.cpp:16:22: warning: control reaches end of non-void function [-Wreturn-type]
   16 |     vector<int> vis(n);
      |                      ^
# Verdict Execution time Memory Grader output
1 Correct 58 ms 212 KB correct
2 Correct 537 ms 280 KB correct
3 Correct 685 ms 280 KB correct
4 Correct 2 ms 212 KB correct
5 Correct 1 ms 304 KB correct
6 Correct 14 ms 300 KB correct
7 Correct 0 ms 296 KB correct
8 Correct 0 ms 212 KB correct
9 Correct 1 ms 212 KB correct
10 Correct 4 ms 212 KB correct
11 Correct 1 ms 212 KB correct
12 Correct 5 ms 212 KB correct
13 Correct 175 ms 292 KB correct
# Verdict Execution time Memory Grader output
1 Correct 58 ms 212 KB correct
2 Correct 537 ms 280 KB correct
3 Correct 685 ms 280 KB correct
4 Correct 2 ms 212 KB correct
5 Correct 1 ms 304 KB correct
6 Correct 14 ms 300 KB correct
7 Correct 0 ms 296 KB correct
8 Correct 0 ms 212 KB correct
9 Correct 1 ms 212 KB correct
10 Correct 4 ms 212 KB correct
11 Correct 1 ms 212 KB correct
12 Correct 5 ms 212 KB correct
13 Correct 175 ms 292 KB correct
14 Runtime error 5 ms 468 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 58 ms 212 KB correct
2 Correct 537 ms 280 KB correct
3 Correct 685 ms 280 KB correct
4 Correct 2 ms 212 KB correct
5 Correct 1 ms 304 KB correct
6 Correct 14 ms 300 KB correct
7 Correct 0 ms 296 KB correct
8 Correct 0 ms 212 KB correct
9 Correct 1 ms 212 KB correct
10 Correct 4 ms 212 KB correct
11 Correct 1 ms 212 KB correct
12 Correct 5 ms 212 KB correct
13 Correct 175 ms 292 KB correct
14 Runtime error 5 ms 468 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB correct
2 Runtime error 5 ms 428 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 58 ms 212 KB correct
2 Correct 537 ms 280 KB correct
3 Correct 685 ms 280 KB correct
4 Correct 2 ms 212 KB correct
5 Correct 1 ms 304 KB correct
6 Correct 14 ms 300 KB correct
7 Correct 0 ms 296 KB correct
8 Correct 0 ms 212 KB correct
9 Correct 1 ms 212 KB correct
10 Correct 4 ms 212 KB correct
11 Correct 1 ms 212 KB correct
12 Correct 5 ms 212 KB correct
13 Correct 175 ms 292 KB correct
14 Runtime error 5 ms 468 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -