제출 #1154044

#제출 시각아이디문제언어결과실행 시간메모리
1154044dzuizzVlak (COCI20_vlak)C++20
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
int n,m,i;
string s,r;
struct node{
  node* v[26];
  bool k;
  node(bool _k): k(_k) {}
  void add(string s){
    if(!s.size()) return;
    if(!v[s[0]-'a'])
      v[s[0]-'a']=new node(k^1);
    v[s[0]-'a']->add(s.substr(1,(int)s.size()-1));
  }
  bool qry(){
    for(auto&nx:v){
      if(!nx) continue;
      if(nx->qry()==k^1) return k^1;
    }
    return k;
  }
} *root;
signed main(){
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cin>>n;
  root=new node(1);
  for(i=0;i<n;++i){
    cin>>s; r="";
    for(auto&c:s) if((r+=s[j]).size()&1)
      root->add(r);
  }
  cin>>m;
  for(i=0;i<m;++i){
    cin>>s; r="";
    for(auto&c:s) if((r+=s[j]).size()&1^1)
      root->add(r);
  }
  cout<<(root->qry()?"Emilija\n":"Nina\n");
  return 0;
}

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

Main.cpp: In function 'int main()':
Main.cpp:29:28: error: 'j' was not declared in this scope
   29 |     for(auto&c:s) if((r+=s[j]).size()&1)
      |                            ^
Main.cpp:35:28: error: 'j' was not declared in this scope
   35 |     for(auto&c:s) if((r+=s[j]).size()&1^1)
      |                            ^