Submission #1160216

#TimeUsernameProblemLanguageResultExecution timeMemory
1160216hainam2k9Bitaro’s Party (JOI18_bitaro)C++20
0 / 100
1 ms2632 KiB
#include <bits/stdc++.h> #define tt cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(0) #define fo freopen((NAME+".INP").c_str(), "r", stdin), freopen((NAME+".OUT").c_str(), "w", stdout) #define ll long long #define ull unsigned long long #define i128 __int128 #define db long double #define sz(a) ((int)(a).size()) #define pb emplace_back #define pf emplace_front #define pob pop_back #define pof pop_front #define lb lower_bound #define ub upper_bound #define fi first #define se second #define ins emplace #define mp make_pair using namespace std; const int MOD = 1e9+7, MAXN = 1e5+5; const string NAME = ""; int n,m,q,t,x,y,dist[MAXN],a[MAXN]; vector<int> adj[MAXN]; bool vis[MAXN]; int main() { tt; if(fopen((NAME + ".INP").c_str(), "r")) fo; cin >> n >> m >> q; for(int i = 1; i<=m; ++i) cin >> x >> y, adj[x].pb(y); for(int i = 1; i<=n; ++i) for(int j : adj[i]) dist[j]=dist[i]+1; while(q--){ int rs=-1; cin >> t >> y; for(int i = 1; i<=y; ++i) cin >> a[i]; for(int i = 1; i<=t; ++i) if((i<=y&&a[i]!=i)||i>y){ rs=dist[t]-dist[i]; break; } cout << rs << "\n"; } }

Compilation message (stderr)

bitaro.cpp: In function 'int main()':
bitaro.cpp:3:19: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    3 | #define fo freopen((NAME+".INP").c_str(), "r", stdin), freopen((NAME+".OUT").c_str(), "w", stdout)
      |            ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bitaro.cpp:28:45: note: in expansion of macro 'fo'
   28 |     if(fopen((NAME + ".INP").c_str(), "r")) fo;
      |                                             ^~
bitaro.cpp:3:63: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    3 | #define fo freopen((NAME+".INP").c_str(), "r", stdin), freopen((NAME+".OUT").c_str(), "w", stdout)
      |                                                        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bitaro.cpp:28:45: note: in expansion of macro 'fo'
   28 |     if(fopen((NAME + ".INP").c_str(), "r")) fo;
      |                                             ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...