답안 #596228

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
596228 2022-07-14T13:43:47 Z Mohammed_Atalah Simurgh (IOI17_simurgh) C++17
0 / 100
1 ms 296 KB
// Template path: /home/mohammed/.config/sublime-text-3/Packages/User

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;

// typedef
typedef long long ll;
typedef long double ld;
typedef vector<int> vecint;
typedef vector<char> vecchar;
typedef vector<string> vecstr;
typedef vector<long long> vecll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

// Marcos
#define endl ("\n")
// #define int long long
#define mod 1000000007
#define pi (3.141592653589)
#define REP(i,a,b) for (int i = a; i < b; i++)
#define RREP(i,a,b) for (int i = a; i > b; i--)
#define PFD(n) cout.precision(n) // PFN == Print Full Double
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)

// Functions
long long squared(long long x) {return (x * x) % mod;}
int factorial(int n) {long long res = 1; for (int i = 1; i <= n; i++) {res = ((res * i) % mod + mod) % mod ;} return res;}
long long power(long long x, long long p) {if (p == 0) {return 1;} if (p % 2 == 1) {return (power(x, p - 1) * x) % mod;} return squared(power(x, p / 2));}


#include "simurgh.h"

std::vector<int> find_roads(int n, std::vector<int> u, std::vector<int> v) {
	int sz = u.size();
	vector<int> vv;
	for (int i = 0 ; i < n - 1; i++) {
		vv.push_back(i);
	}
	int curr = count_common_roads(vv);
	if (curr == n - 1) {
		return vv;
	}
	vector<int> same;
	same.push_back(vv[n - 2]);
	bool golden  = false;
	for (int i = n - 1 ; i < sz; i++) {
		vv[n - 2] = i;
		int e = count_common_roads(vv);
		if (e  < curr) {
			golden = true;
		}
		if (e == curr) {
			same.push_back(i);
		}
	}

	vv.clear();
	for (int i = 0 ; i < n - 1 ; i++) {
		vv.push_back(same[0]);
	}

	curr = count_common_roads(vv);

	for (int i = 0 ; i < n - 1 ; i++) {
		vv[0] = i;
		int e = count_common_roads(vv);
		if (e == curr) {
			same.push_back(i);
		}
	}

	if (golden) {
		return vv;
	} else {
		set<int> ss;
		for (int i = 0 ; i < sz ; i++) {
			ss.insert(i);
		}
		for (auto & i : vv) {
			auto it = ss.lower_bound(i);
			ss.erase(it);
		}
		vv.clear();
		for (auto &i : ss) {
			vv.push_back(i);
		}
		return vv;
	}


}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB correct
2 Incorrect 1 ms 296 KB WA in grader: NO
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB WA in grader: NO
2 Halted 0 ms 0 KB -