Submission #613738

# Submission time Handle Problem Language Result Execution time Memory
613738 2022-07-30T10:00:28 Z Mr_Husanboy Simurgh (IOI17_simurgh) C++14
0 / 100
5 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<pair<int,int>> g[1005];

vector<int> find_roads(int n, vector<int> u, vector<int> v) {
	vector<int> p;
	for(int i=0; i<u.size(); i++){
        g[u[i]].push_back({v[i],i});
        g[v[i]].emplace_back(u[i],i);
	}
	for(int i=0; i<n; i++) p.push_back(i);
	do{
        bool ok = 1;
        vector<int> tem;
        for(int i=1; i<n && ok; i++){
            bool found = 0;
            for(auto u : g[p[i]]){
                if(u.ff == p[i-1]){
                    found = 1;
                    tem.push_back(u.ss);
                    break;
                }

            }
            ok &= found;
        }
        //for(auto u:tem) cout << u << ' '; cout << ok<<"tem" << endl;
        if(ok){

            if(count_common_roads(tem) == n-1) return tem;
        }
	}while(next_permutation(all(p)));
}

Compilation message

simurgh.cpp: In function 'std::vector<int> find_roads(int, std::vector<int>, std::vector<int>)':
simurgh.cpp:15:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |  for(int i=0; i<u.size(); i++){
      |               ~^~~~~~~~~
simurgh.cpp:14:14: warning: control reaches end of non-void function [-Wreturn-type]
   14 |  vector<int> p;
      |              ^
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 468 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 468 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 468 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB correct
2 Incorrect 5 ms 324 KB WA in grader: NO
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 468 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -