| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 596243 | Mohammed_Atalah | Simurgh (IOI17_simurgh) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "simurgh.h"
#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;
#include <cstdio>
#include <cassert>
#include <vector>
#include <cstdlib>
#include <string>
using namespace std;
static int MAXQ = 30000;
static int n, m, q = 0;
static vector<int> u, v;
static vector<bool> goal;
static void wrong_answer()
{
printf("NO\n");
exit(0);
}
static bool is_valid(const vector<int>& r)
{
if(int(r.size()) != n - 1){
cout << "size problem" << endl;
return false;
}
for(int i = 0; i < n - 1; i++)
if (r[i] < 0 || r[i] >= m){
cout << "out of index" << endl;
return false;
}
return true;
}
static int _count_common_roads_internal(const vector<int>& r)
{
if(!is_valid(r)){
cout << "is not valid" << endl;
wrong_answer();
}
int common = 0;
for(int i = 0; i < n - 1; i++)
{
bool is_common = goal[r[i]];
if (is_common)
common++;
}
return common;
}
int count_common_roads(const vector<int>& r)
{
q++;
if(q > MAXQ){
cout << "max problem" << endl;
wrong_answer();
}
return _count_common_roads_internal(r);
}
int main()
{
assert(2 == scanf("%d %d", &n, &m));
u.resize(m);
v.resize(m);
for(int i = 0; i < m; i++)
assert(2 == scanf("%d %d", &u[i], &v[i]));
goal.resize(m, false);
for(int i = 0; i < n - 1; i++)
{
int id;
assert(1 == scanf("%d", &id));
goal[id] = true;
}
vector<int> res = find_roads(n, u, v);
///////
cout << "hello" << endl;
if(_count_common_roads_internal(res) != n - 1)
{
cout << "a real WA" << endl;
for(int i = 0 ; i < res.size(); i++)
{
cout << res[i] << " ";
}
cout << endl;
wrong_answer();
}
printf("YES\n");
return 0;
}
