제출 #984046

#제출 시각아이디문제언어결과실행 시간메모리
984046vjudge1게임 (APIO22_game)C++17
60 / 100
956 ms10076 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; #define TL ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); #define rall(s) s.rbegin(),s.rend() #define all(s) s.begin(),s.end() #define pb push_back #define se second #define fi first #define ll long long #define ld long double #define YES cout<<"YES\n" #define Yes cout<<"Yes\n" #define yes cout<<"yes\n" #define NO cout<<"NO\n" #define No cout<<"No\n" #define no cout<<"no\n" const int N = 1e5 + 9 , mod = 1e9 + 7; int a[N][2] ; vector<int>v[N][2]; int n , k; int ans = 0 , ind1 = 0; vector<int>v1; void get(int x , int y , int f ){ a[x][y] = f; for(auto to : v[x][y]) if(!a[to][y]){ get(to , y , f); }else if((f < a[to][y] && y == 1) || (f > a[to][y]) && y == 0){ get(to , y , f); } } void init(int n, int k){ ::n = n , ::k = k; for(int i = 1; i <= k; i++) a[i][0] = a[i][1] = i; } int add_teleporter(int x , int y){ if(ans == 1) return ans; x++ , y++; v[x][0].pb(y); v[y][1].pb(x); if(a[y][1] && a[y][1] <= a[x][0]) ans = 1; if(a[y][1] && (a[y][1] < a[x][1] || a[x][1] == 0)){ get(x , 1 , a[y][1]); } if(a[x][0] && (a[x][0] > a[y][0] || a[y][0] == 0)){ get(y , 0 , a[x][0]); } return ans; } /* int main(){ TL; #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif init(4 , 2); cout<<add_teleporter(0 , 2)<<"\n"; //cout<<add_teleporter(5 , 0)<<"\n"; //cout<<add_teleporter(4 , 5)<<"\n"; //cout<<add_teleporter(5 , 3)<<"\n"; //cout<<add_teleporter(1 , 4)<<"\n"; }*/ // Author : حسن

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

game.cpp: In function 'void get(int, int, int)':
game.cpp:35:61: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   35 |         }else if((f < a[to][y] && y == 1) || (f > a[to][y]) && y == 0){
      |                                              ~~~~~~~~~~~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...