Submission #1103210

#TimeUsernameProblemLanguageResultExecution timeMemory
1103210hiensumiBitaro’s Party (JOI18_bitaro)C++14
14 / 100
2072 ms6492 KiB
#include <bits/stdc++.h> using namespace std; #define fod(i,a,b) for(int i((int) (a)), _b(b); i <= _b; i++) #define fok(i,a,b) for(int i((int) (a)), _b(b); i >= _b; i--) #define ll long long #define pb push_back #define mp make_pair #define pii pair<int,int> #define fi first #define se second #define ve vector #define vi ve<int> #define vll ve<ll> #define el '\n' #define mask(i) (1LL<<(i)) #define BIT(msk,i) (msk>>(i)&1LL) template<class T> bool mini(T &a, T b){ return (a > (b) ? a = (b), 1 : 0); } template<class T> bool maxi(T &a, T b){ return (a < (b) ? a = (b), 1 : 0); } const int base = mask(20) + 5; #define name "bitaro_party" int n, m, q; const int N = 1e5; const int M = 2e5; const int Q = 1e5; ve <vi> g; namespace sub1{ bool check(){ return 1; } int host, num; int dp[N + 5]; void solve(){ fod(i,1,n) sort(g[i].begin(), g[i].end()); while(q--){ cin >> host >> num; fod(i,1,host) dp[i] = 0; fod(i,1,num){ int x; cin >> x; dp[x] = -1e9; } fod(i,1,host){ for(int j : g[i]){ if(j <= host) maxi(dp[j], dp[i] + 1); else break; } } cout << max(dp[host], -1) << el; } } } int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); if(fopen(name".inp", "r")){ freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); } cin >> n >> m >> q; { int u, v; g.resize(n + 1); fod(i,1,m){ cin >> u >> v; g[u].pb(v); } } if(sub1 :: check()) sub1 :: solve(); return 0; }

Compilation message (stderr)

bitaro.cpp: In function 'int main()':
bitaro.cpp:68:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   68 |         freopen(name".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
bitaro.cpp:69:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   69 |         freopen(name".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...