제출 #218497

#제출 시각아이디문제언어결과실행 시간메모리
218497patrikpavic2Long Mansion (JOI17_long_mansion)C++17
5 / 100
3088 ms16504 KiB
#include <cstdio> #include <vector> #define X first #define Y second #define PB push_back using namespace std; const int N = 5e5 + 500; int c[N], L[N], R[N], ima[N], tL[N], tR[N], C[N]; vector < int > mogu[N]; inline void clean(int l,int r){ for(int i = l;i < r;i++){ for(int x : mogu[i]) ima[x] = 0; } } inline void ubaci(int i){ for(int x : mogu[i]) ima[x] = 1; } inline void siri(int l,int r, int &cL, int &cR){ for(;;){ if(cL > l && ima[C[cL - 1]]){ cL--; if(cL != l) ubaci(cL - 1); continue; } if(cR < r && ima[C[cR + 1]]){ cR++; if(cR != r) ubaci(cR); continue; } break; } } int n, q; int main(){ scanf("%d", &n); for(int i = 1;i < n;i++) scanf("%d", C + i); for(int i = 0;i < n;i++){ int kol; scanf("%d", &kol); for(;kol--;){ int x; scanf("%d", &x); mogu[i].PB(x); } } scanf("%d", &q); for(;q--;){ int x, y; scanf("%d%d", &x, &y); x--, y--; int ll = x + 1, rr = x; ubaci(x); siri(0, n, ll, rr); printf((ll - 1 <= y && y <= rr) ? "YES\n" : "NO\n"); clean(0, n); } }

컴파일 시 표준 에러 (stderr) 메시지

long_mansion.cpp: In function 'int main()':
long_mansion.cpp:48:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
long_mansion.cpp:50:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", C + i);
   ~~~~~^~~~~~~~~~~~~
long_mansion.cpp:52:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int kol; scanf("%d", &kol);
            ~~~~~^~~~~~~~~~~~
long_mansion.cpp:54:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    int x; scanf("%d", &x);
           ~~~~~^~~~~~~~~~
long_mansion.cpp:58:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &q);
  ~~~~~^~~~~~~~~~
long_mansion.cpp:60:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int x, y; scanf("%d%d", &x, &y); x--, y--;
             ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...