제출 #887563

#제출 시각아이디문제언어결과실행 시간메모리
887563Ahmed57Flights (JOI22_flights)C++17
컴파일 에러
0 ms0 KiB
#include "Ali.h" #include <bits/stdc++.h> using namespace std; int target , ans = 0; void dfs(int i,int pr,int dep){ if(i==target){ ans = dep; } for(auto j:adj[i]){ if(j==pr)continue; dfs(j,i,dep+1); } } int n = 0; void Init(int N, std::vector<int> U, std::vector<int> V){ n = N; for(int i = 0;i<N;i++){ adj[i].clear(); } for(int i = 0;i<N-1;i++){ int a = U[i] , b = V[i]; adj[a].push_back(b); adj[b].push_back(a); } for(int i = 0;i<n;i++){ SetID(i,i); } } string SendA(string S){ int x = 0 , y = 0; for(int i = 0;i<10;i++){ if(S[i]=='1')x^=(1<<i); } for(int i = 10;i<20;i++){ if(S[i]=='1')y^=(1<<(i-10)); } int cnt = 0; string lol; for(int i = 0;i<8;i++){ for(int j = 0;j<8;j++){ int nx = (x|(i<<10)) , ny = (y|(j<<10)); if(nx>=n||ny>=n){ for(int e = cnt;e<cnt+13;e++){ lol+='0'; } }else{ target = ny; dfs(nx,nx,0); for(int e = cnt;e<cnt+13;e++){ if(ans&(1<<e))lol+='1'; else lol+='0'; } } cnt+=13; } } return lol; }
#include "Benjamin.h" #include <bits/stdc++.h> using namespace std; int x , y; string SendB(int N, int X, int Y){ x = X, y = Y; string ans; for(int i = 0;i<10;i++){ if(X&(1<<i))ans+='1'; else ans+='0'; }for(int i = 0;i<10;i++){ if(Y&(1<<i))ans+='1'; else ans+='0'; } return ans; } int Answer(string T){ int cnt = 0; long long ans = 0; for(int i = 0;i<8;i++){ for(int j = 0;j<8;j++){ if(i==x&&j==y){ for(int e = cnt;e<cnt+13;e++){ if(T[e]=='1')ans|=(1<<(e-cnt)); } }else cnt+=13; } } return ans; }

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

Ali.cpp: In function 'void dfs(int, int, int)':
Ali.cpp:10:13: error: 'adj' was not declared in this scope
   10 |  for(auto j:adj[i]){
      |             ^~~
Ali.cpp: In function 'void Init(int, std::vector<int>, std::vector<int>)':
Ali.cpp:19:3: error: 'adj' was not declared in this scope
   19 |   adj[i].clear();
      |   ^~~
Ali.cpp:23:9: error: 'adj' was not declared in this scope
   23 |         adj[a].push_back(b);
      |         ^~~
grader_ali.cpp:10:8: warning: '{anonymous}::_randmem' defined but not used [-Wunused-variable]
   10 |   char _randmem[12379];
      |        ^~~~~~~~