답안 #816406

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
816406 2023-08-09T05:00:50 Z kebine Ekoeko (COCI21_ekoeko) C++17
컴파일 오류
0 ms 0 KB
#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;
}

Compilation message

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]);
      |                     ^~~~