Submission #521146

#TimeUsernameProblemLanguageResultExecution timeMemory
521146CyberSleeperBitaro’s Party (JOI18_bitaro)C++14
0 / 100
2 ms4940 KiB
#include <bits/stdc++.h> #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL) #define debug(x) cout << "Line " << __LINE__ << ", " << #x << " is " << x << endl #define all(x) x.begin(), x.end() #define fi first #define se second #define mp make_pair #define pb push_back #define ll long long #define vll vector<ll> #define ull unsigned long long #define pll pair<ll, ll> #define pii pair<int, int> #define ld long double #define nl '\n' #define tb '\t' #define sp ' ' using namespace std; const int MX=100005, MOD=998244353, BLOCK=327, INF=2e9+7; const ll INFF=1e18+7; const ld ERR=1e-7, pi=3.14159265358979323846; int N, M, Q, vis[MX], cnt; vector<int> adj[MX], C; vector<pii> far[MX]; void comb(int x, int y){ cnt++; vector<pii> ret; int lex=0, ley=0; while(ret.size()<BLOCK && lex<far[x].size() && ley<far[y].size()){ pii le=far[x][lex], ri=far[y][ley]; le.fi++; if(le >= ri){ ret.pb(le); vis[le.se]=cnt; lex++; }else{ ret.pb(ri); vis[ri.se]=cnt; ley++; } while(lex<far[x].size() && vis[far[x][lex].se] == cnt) lex++; while(ley<far[y].size() && vis[far[y][ley].se] == cnt) ley++; } while(ret.size()<BLOCK && lex<far[x].size()){ if(vis[far[x][lex].se] != cnt){ ret.pb(far[x][lex]); ret.back().fi++; } lex++; } while(ret.size()<BLOCK && ley<far[y].size()){ if(vis[far[y][ley].se] != cnt) ret.pb(far[y][ley]); ley++; } far[y]=ret; } int DFS(int x){ int ret=(vis[x]==Q ? -INF : 0); for(auto i:adj[x]){ ret=max(ret, DFS(i)+1); } return ret; } int main() { fastio; cin >> N >> M >> Q; for(int i=0, u, v; i<M; i++){ cin >> u >> v; adj[v].pb(u); } while(Q--){ int X, Y; cin >> X >> Y; for(int i=Y, x; i>0; i--){ cin >> x; if(x>X){ Y--; }else{ vis[x]=Q; } } if(Y==X){ cout << "-1\n"; continue; } cout << DFS(X) << nl; } }

Compilation message (stderr)

bitaro.cpp: In function 'void comb(int, int)':
bitaro.cpp:32:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     while(ret.size()<BLOCK && lex<far[x].size() && ley<far[y].size()){
      |                               ~~~^~~~~~~~~~~~~~
bitaro.cpp:32:55: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     while(ret.size()<BLOCK && lex<far[x].size() && ley<far[y].size()){
      |                                                    ~~~^~~~~~~~~~~~~~
bitaro.cpp:44:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |         while(lex<far[x].size() && vis[far[x][lex].se] == cnt)
      |               ~~~^~~~~~~~~~~~~~
bitaro.cpp:46:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |         while(ley<far[y].size() && vis[far[y][ley].se] == cnt)
      |               ~~~^~~~~~~~~~~~~~
bitaro.cpp:49:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |     while(ret.size()<BLOCK && lex<far[x].size()){
      |                               ~~~^~~~~~~~~~~~~~
bitaro.cpp:56:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |     while(ret.size()<BLOCK && ley<far[y].size()){
      |                               ~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...