# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
72683 | 2018-08-26T14:20:19 Z | mhnd | Simurgh (IOI17_simurgh) | C++14 | 3 ms | 432 KB |
#include "simurgh.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; const int N = 2e5+50; const int oo = 1e9; const int mod = 1e9+7; vector<pair<int,int>> g[510]; bool taken[510],used[N]; vector<int> find_roads(int n, vector<int> U, vector<int> V) { for(int i=0;i<(int)U.size();i++){ g[U[i]].push_back({V[i],i}); g[V[i]].push_back({U[i],i}); } vector<int> ans; for(int i=0;i<n;i++){ for(int j=0;j<g[i].size();j++){ int v = g[i][j].first; int w = g[i][j].second; if(taken[i] && taken[v] || used[w])continue; taken[i]=taken[v]=1; used[w]=1; ans.push_back(w); } } int lst = count_common_roads(ans); for(int i=0;i<ans.size();i++){ int cur = 0; taken[U[ans[i]]]=taken[V[ans[i]]]=0; bool f=0; for(int j=0;j<g[U[ans[i]]].size();j++){ int v = g[U[ans[i]]][j].first; int u = U[ans[i]]; if((taken[u] && taken[v]) || used[g[U[ans[i]]][j].second])continue; int tmp = ans[i]; ans[i] = g[U[ans[i]]][j].second; cur = count_common_roads(ans); if(cur > lst){ taken[v]=taken[u]=1; used[ans[i]]=1; f=1; lst = cur; break; } ans[i] = tmp; } if(f)continue; taken[U[ans[i]]]=taken[V[ans[i]]]=1; } sort(ans.begin(),ans.end()); return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 248 KB | WA in grader: NO |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 248 KB | WA in grader: NO |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 248 KB | WA in grader: NO |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 356 KB | correct |
2 | Incorrect | 3 ms | 432 KB | WA in grader: NO |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 248 KB | WA in grader: NO |
2 | Halted | 0 ms | 0 KB | - |