제출 #816406

#제출 시각아이디문제언어결과실행 시간메모리
816406kebineEkoeko (COCI21_ekoeko)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, ans=0; cin >> n; vecctor<int> pos(26, -1), poss(26); for(int i=0; i<n; i++) { char c; cin >> c; pos[c-'a']=i; } string s; cin >> s; for(int i=0; i<n; i++) poss[s[i]-'a']=i; for(int i=0; i<26; i++) { if(pos[i]==-1) continue; ans+=abs(pos[i]-poss[i]); poss[s[pos[i]]]=poss[i]; } cout << ans << '\n'; return 0; }

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

Main.cpp: In function 'int main()':
Main.cpp:6:3: error: 'vecctor' was not declared in this scope
    6 |   vecctor<int> pos(26, -1), poss(26);
      |   ^~~~~~~
Main.cpp:6:11: error: expected primary-expression before 'int'
    6 |   vecctor<int> pos(26, -1), poss(26);
      |           ^~~
Main.cpp:9:5: error: 'pos' was not declared in this scope; did you mean 'pow'?
    9 |     pos[c-'a']=i;
      |     ^~~
      |     pow
Main.cpp:12:26: error: 'poss' was not declared in this scope
   12 |   for(int i=0; i<n; i++) poss[s[i]-'a']=i;
      |                          ^~~~
Main.cpp:14:8: error: 'pos' was not declared in this scope; did you mean 'pow'?
   14 |     if(pos[i]==-1) continue;
      |        ^~~
      |        pow
Main.cpp:15:14: error: 'pos' was not declared in this scope; did you mean 'pow'?
   15 |     ans+=abs(pos[i]-poss[i]);
      |              ^~~
      |              pow
Main.cpp:15:21: error: 'poss' was not declared in this scope
   15 |     ans+=abs(pos[i]-poss[i]);
      |                     ^~~~