제출 #144903

#제출 시각아이디문제언어결과실행 시간메모리
144903LittleFlowers__Arranging Shoes (IOI19_shoes)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int rnd(int l,int r){return l+rng()%(r-l+1);} #define in ({int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;}) #define fasty ios_base::sync_with_stdio(false),cin.tie(nullptr); #define task "shoes" #define forinc(a,b,c) for(int a=b,_c=c;a<=_c;++a) #define fordec(a,b,c) for(int a=b,_c=c;a>=_c;--a) #define forv(a,b) for(auto&a:b) #define fi first #define se second #define pb push_back #define ii pair<int,int> #define mt make_tuple #define all(a) a.begin(),a.end() #define reset(f, x) memset(f, x, sizeof(f)) #define bit(x,i) ((x>>(i-1))&1) #define on(x,i) (x|(1ll<<(i-1))) #define off(x,i) (x&~(1<<(i-1))) const int N=100010; int bit[N*2] queue<int> s[N*2]; void upd(int i,int x){ for(;i<N;i+=i&-i) bit[i]+=x; } int que(int i){ int ret=0; for(;i;i-=i&-i) ret+=bit[i]; return ret; } long long count_swaps(vector<int> v){ long long ret=0; forinc(i,1,v.size()){ int a=v[i-1]; if(s[N-a].size()){ int j=s[N-a].front(); s[N-a].pop(); ret+=i-j-(a>0); ret-=que(i)-que(j); } else{ s[N+a].push(i); upd(i,1); } } return ret; }

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

shoes.cpp:25:1: error: expected initializer before 'queue'
 queue<int> s[N*2];
 ^~~~~
shoes.cpp: In function 'void upd(int, int)':
shoes.cpp:28:20: error: 'bit' was not declared in this scope
  for(;i<N;i+=i&-i) bit[i]+=x;
                    ^~~
shoes.cpp: In function 'int que(int)':
shoes.cpp:32:23: error: 'bit' was not declared in this scope
  for(;i;i-=i&-i) ret+=bit[i];
                       ^~~
shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:40:6: error: 's' was not declared in this scope
   if(s[N-a].size()){
      ^