제출 #336137

#제출 시각아이디문제언어결과실행 시간메모리
336137bigDuck게임 (IOI14_game)C++14
42 / 100
1095 ms13676 KiB
#include<bits/stdc++.h> using namespace std; #define INIT ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); #define mp make_pair #define pb push_back #define ft first #define sc second #define ll long long #define pii pair<int, int> #define count_bits __builtin_popcount #include "game.h" multiset<int> g[1510]; int N; void initialize(int n) { N=n; for(int i=0; i<n; i++){ for(int j=i+1; j<n; j++){ g[i].insert(j); g[j].insert(i); } } } int v[1510]; int is_bridge(int x, int y, int ac){ int n=N; queue<int> q1, q2; v[x]=ac; v[y]=ac+1; q1.push(x); q2.push(y); while((!q1.empty()) && (!q2.empty()) ){ int f1=q1.front(); q1.pop(); //cout<<"f1: "<<f1<<" "; if( (v[f1]==(ac+1) ) ){ g[x].erase(g[x].find(y)); g[y].erase(g[y].find(x) ); //cout<<"\n"<<flush; return 0; } v[f1]=ac; for(auto it=g[f1].begin(); it!=g[f1].end(); it++){ //cout<<*it<<" "; if( (v[*it]!=ac) && ( (*it)!=y) ){ //cout<<*it<<"g1 "; if( v[*it]==(ac+1) ){ g[x].erase(g[x].find(y)); g[y].erase(g[y].find(x) ); //cout<<"\n"<<flush; return 0; } v[*it]=ac; q1.push(*it); } } //cout<<"2x\n"; int f2=q2.front(); q2.pop(); //cout<<"f2: "<<f2<<" "; if( (v[f2]==(ac) ) ){ g[x].erase(g[x].find(y)); g[y].erase(g[y].find(x) ); // cout<<"\n"<<flush; return 0; } v[f2]=ac+1; for(auto it=g[f2].begin(); it!=g[f2].end(); it++){ //cout<<*it<<" "; if( (v[*it]!=(ac+1)) && ( (*it)!=x ) ){ if( v[*it]==(ac) ){ g[x].erase(g[x].find(y)); g[y].erase(g[y].find(x) ); //cout<<"\n"<<flush; return 0; } v[*it]=ac+1; q2.push(*it); } } } //cout<<"\n"<<flush; return 1; } int ac=1; int hasEdge(int u, int v) { ac+=3; return is_bridge(u, v, ac); }

컴파일 시 표준 에러 (stderr) 메시지

game.cpp: In function 'int is_bridge(int, int, int)':
game.cpp:34:5: warning: unused variable 'n' [-Wunused-variable]
   34 | int n=N;
      |     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...