제출 #1160213

#제출 시각아이디문제언어결과실행 시간메모리
1160213hainam2k9Bitaro’s Party (JOI18_bitaro)C++20
0 / 100
1 ms2628 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,depth[MAXN];
vector<int> adj[MAXN];
bool vis[MAXN];
void dfs(int u){
    vis[u]=1;
    for(int v : adj[u])
        if(!vis[v]) depth[v]=depth[u]+1, dfs(v);
}
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);
    dfs(1);
    while(q--){
        int rs=-1;
        cin >> t >> y;
        for(int i = 1; i<=y; ++i){
            cin >> x;
            if(i!=x) rs=max(rs,depth[t]-depth[i]);
        }
        if(rs==-1) rs=max(rs,depth[t]-depth[y+1]);
        cout << rs << "\n";
    }
}

컴파일 시 표준 에러 (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:33:45: note: in expansion of macro 'fo'
   33 |     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:33:45: note: in expansion of macro 'fo'
   33 |     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...