Submission #613742

# Submission time Handle Problem Language Result Execution time Memory
613742 2022-07-30T10:04:04 Z Mr_Husanboy Simurgh (IOI17_simurgh) C++14
0 / 100
6 ms 212 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)));
	return vi{1};
}

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++){
      |               ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 212 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 212 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 212 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB correct
2 Incorrect 6 ms 212 KB WA in grader: NO
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 212 KB WA in grader: NO
2 Halted 0 ms 0 KB -