# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1006437 | devariaota | Game (IOI14_game) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include "game.h"
/* Pragmaaa */
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
/* Primitive Data */
#define ll long long
#define db double
/* Pair Macro */
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define sc second
/* Vector Macro */
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
/* All Rounder */
#define all(x) x.begin(),x.end()
#define forn(i,n) for(int (i) = 1; i<= int (n); i++)
#define for0(i,n) for(int (i) = 0; i < int (n); i++)
#define INF 1e9
#define LLINF 1e18
#define nl '\n'
#define tab ' '
// Hati-hati kalau mau ngeflush tapi endl jadi nya '\n'
#define flushmanual ios_base::sync_with_stdio(false); cin.tie(NULL)
/* Modulo Fuctions */
const ll MOD = 1e9+7;
ll tambah(ll a, ll b){
return (a+b)%MOD;
}
ll kurang(ll a, ll b){
return (((a - b) % MOD) + MOD) % MOD;
}
ll mul(ll a, ll b){
return ((a%MOD) * (b%MOD))%MOD;
}
/* debuggin */
#define debugl cout<<"Here\n"
#define debug(awok) cout<<(awok)<<endl
/* stuff you should look for
* int overflow, array bounds
* special cases (n=1?)
* do smth instead of nothing and stay organized
* WRITE STUFF DOWN
* DON'T GET STUCK ON ONE APPROACH (TRY DP INSTEAD OF GREEDY AND VICE VERSA)(DONT FORGET SORTING)
* TRY ALL STRATEGIES
* DO NOT READ EDITORIALS BEFORE TRYING REALLY HARD!
* careful references in recursion
* careful copying when doing vectors esp in loops and functions
* careful long long int and mod always OMG
* careful return types of std such as int(ceil)
* WATCH OUT GOING OVER MAX thru operations spam mod
* vectors overflow arrays do NOT
* cout endl lol
* lower bound is first greater or equal
* upper is first greater
* if TLE play around with compiler
* use static is helpful!!
* take note of test stuff that need to be changed before submission
* careful when u use garbage from abroad
* careful modeling stuff as num going below 0 above n
* number theory infinite due to multple of each other
* careful not finding stuff in dictionaries
* stupid cout precision and sci notations
* in sets, rbegin() or --end() for last
* careful multiset removal just use heapp
* no segment trees if partial mins are needed, use sparse table
* in combinatorics log matters esp in that dp, and think v carefully
* NEVER INPUT DOUBLES
* fraction class or multiplication tricks?
* omg dont forget to flush when debugging
* watch out for bitwise operations order of operations
* PQ Greater top is smallest and Less top is largest
*/
using namespace std;
ll que[2000];
bool hasEdge(ll u,ll v){
if(que[u] == 1 || que[v] == 1){
return 1;
}else{
return 0;
}
}
void initialize(ll n){
for0(i,n)que[i] = n-1;
forn(i,(n*(n-1)/2)){
ll a,b;
cin >> a >> b;
cout << hasEdge(a,b) << endl;
que[a]--;
que[b]--;
}
}