제출 #211126

#제출 시각아이디문제언어결과실행 시간메모리
211126vincent97198Arranging Shoes (IOI19_shoes)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define N 100005 using namespace std; int BIT[2*N]; inline int lowbit(int x) { return x&(-x); } void add(int pos,int val) { for(;pos<N;pos+=lowbit(pos)) BIT[pos]+=val; } int sum(int pos) { int ret=0; for(;pos>0;pos-=lowbit(pos)) ret+=BIT[pos]; return ret; } long long count_swap(vector<int> S) { map<ll,queue<int>> mp; long long ans=0; for(int i=0;i<S.size();++i){ mp[S[i]].push(i); add(i+1,1); } for(int i=0;i<S.size();++i){ mp[S[i]].pop(); int t=mp[-S[i]].front(); mp[-S[i]].pop(); ans+=(sum(i+1)-sum(t-1)); add(t,-1); } return ans; }

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

shoes.cpp: In function 'long long int count_swap(std::vector<int>)':
shoes.cpp:29:6: error: 'll' was not declared in this scope
  map<ll,queue<int>> mp;
      ^~
shoes.cpp:29:18: error: template argument 1 is invalid
  map<ll,queue<int>> mp;
                  ^~
shoes.cpp:29:18: error: template argument 3 is invalid
shoes.cpp:29:18: error: template argument 4 is invalid
shoes.cpp:32:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<S.size();++i){
              ~^~~~~~~~~
shoes.cpp:33:10: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}]' for array subscript
   mp[S[i]].push(i);
          ^
shoes.cpp:36:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<S.size();++i){
              ~^~~~~~~~~
shoes.cpp:37:10: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}]' for array subscript
   mp[S[i]].pop();
          ^
shoes.cpp:38:17: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}]' for array subscript
   int t=mp[-S[i]].front(); mp[-S[i]].pop();
                 ^
shoes.cpp:38:36: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}]' for array subscript
   int t=mp[-S[i]].front(); mp[-S[i]].pop();
                                    ^