제출 #1311413

#제출 시각아이디문제언어결과실행 시간메모리
1311413nikoloz-chArranging Shoes (IOI19_shoes)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "shoes.h"
using namespace std;

long long count_swaps(vector<int> &S){
    int ans = 0;
    map<int,int> mp;
    for(int i = 0; i < S.size(); i++){
        mp[S[i]] = i;
    }
    for(int i = 0; i < S.size(); i++){
        if(S[i] < 0) continue;
        if(st.find(S[i]) != st.end()){
            ans += abs(mp[S[i]]-mp[-S[i]]);
            st.insert(-S[i]); st.insert(S[i]);
        }
    }
    return ans;
}

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

shoes.cpp: In function 'long long int count_swaps(std::vector<int>&)':
shoes.cpp:13:12: error: 'st' was not declared in this scope; did you mean 'std'?
   13 |         if(st.find(S[i]) != st.end()){
      |            ^~
      |            std