| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 70630 | khohko | Alternating Current (BOI18_alternating) | C++17 | Compilation error | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
#define ll long long
#define pb push_back
#define fr first
#define sc second
#define MAX ((ll)(1e12+100))
#define MX ((ll)(1e6+100))
#define ARRS ((ll)(2e6+100))
#define HS ((ll)(233))
#define MOD ((ll)(1e9+7))
#define EP ((double)(1e-9))
#define LG 21
#define mul(a,b) a=((a)*(b))%MOD
using namespace std;
ll n,m;
pair<ll,pair<ll,ll> > a[ARRS];
ll pas[ARRS];
void eend(){
cout<<"impossible";
exit(0);
}
void rot(ll x){
for(int i=0; i<m; i++){
a[i].fr=(a[i].fr+n-x)%n+1;
a[i].sc=(a[i].sc+n-x)%n+1;
}
}
int main(){
#ifdef KHOKHO
freopen("indndklvnlkvljnvdsvndkvjdsklvndslkvsdkvdsnvklvnlkdnlkdv;jbfkjdlm@edvlkoijmlkk
vikdnvlsdlkm[;';nv
javlvv
vkav;ld
psv
aovav
aao[sa'malvmamsa;sanvks;f;ksf;lmvlsam'v'savpkavmav
vn'vma'lvm'al
vka;k
nikabbis noob kvkanvll l vj lppivnaksv baqar is genius fnljvla lvanpo si also noob ahahahahahv avav
vjavlaj
vanslvaslkv
vknlkl
@Inlnvundvlvj lKA; i kl flanlvvldjvndajlnvijjpmvlalvnasvll.in","r",stdin);
freopen("out.out","w",stdout);
#endif // KHOKHO
cin>>n>>m;
pair<ll,ll> mx={-1,0};
for(int i=0; i<m; i++){
cin>>a[i].fr>>a[i].sc.fr;
if(a[i].fr<=a[i].sc.fr)
mx=max(mx,{a[i].sc.fr-a[i].fr,i});
else
mx=max(mx,{n-(a[i].fr-a[i].sc.fr)+1,i});
a[i].sc.sc=i;
}
sort(a,a+m);
ll ma=0,mb=0,j=0;
multiset<pair<ll,ll> > st;
for(int i=1; i<=n; i++){
while(j<m&&a[j].fr==i)st.insert(a[j].sc),j++;
while(st.size()&&st.begin()->fr<i)st.erase(st.begin());
if(ma<i){
if(!st.size())eend();
ma=st.begin()->fr;
pas[st.begin()->sc]=1;
st.erase(st.begin());
}
if(mb<i){
if(!st.size())eend();
mb=st.begin()->fr;
pas[st.begin()->sc]=0;
st.erase(st.begin());
}
}
for(int i=0; i<m; i++)
cout<<pas[i];
}
Compilation message (stderr)
alternating.cpp:36:11: warning: missing terminating " character
freopen("indndklvnlkvljnvdsvndkvjdsklvndslkvsdkvdsnvklvnlkdnlkdv;jbfkjdlm@edvlkoijmlkk
^
alternating.cpp:39:20: warning: missing terminating ' character
vikdnvlsdlkm[;';nv
^
alternating.cpp:46:45: warning: missing terminating ' character
aao[sa'malvmamsa;sanvks;f;ksf;lmvlsam'v'savpkavmav
^
alternating.cpp:48:16: warning: missing terminating ' character
vn'vma'lvm'al
^
alternating.cpp:61:71: warning: missing terminating " character
@Inlnvundvlvj lKA; i kl flanlvvldjvndajlnvijjpmvlalvnasvll.in","r",stdin);
^
alternating.cpp: In function 'void rot(long long int)':
alternating.cpp:30:19: error: no match for 'operator+' (operand types are 'std::pair<long long int, long long int>' and 'long long int')
a[i].sc=(a[i].sc+n-x)%n+1;
~~~~~~~^~
In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0,
from /usr/include/c++/7/bits/specfun.h:45,
from /usr/include/c++/7/cmath:1914,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
from alternating.cpp:1:
/usr/include/c++/7/bits/stl_iterator.h:397:5: note: candidate: template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename std::reverse_iterator<_Iterator>::difference_type, const std::reverse_iterator<_Iterator>&)
operator+(typename reverse_iterator<_Iterator>::difference_type __n,
^~~~~~~~
/usr/include/c++/7/bits/stl_iterator.h:397:5: note: template argument deduction/substitution failed:
alternating.cpp:30:20: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'long long int'
a[i].sc=(a[i].sc+n-x)%n+1;
^
In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0,
from /usr/include/c++/7/bits/specfun.h:45,
from /usr/include/c++/7/cmath:1914,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
from alternating.cpp:1:
/usr/include/c++/7/bits/stl_iterator.h:1198:5: note: candidate: template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename std::move_iterator<_IteratorL>::difference_type, const std::move_iterator<_IteratorL>&)
operator+(typename move_iterator<_Iterator>::difference_type __n,
^~~~~~~~
/usr/include/c++/7/bits/stl_iterator.h:1198:5: note: template argument deduction/substitution failed:
alternating.cpp:30:20: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'long long int'
a[i].sc=(a[i].sc+n-x)%n+1;
^
In file included from /usr/include/c++/7/string:52:0,
from /usr/include/c++/7/bits/locale_classes.h:40,
from /usr/include/c++/7/bits/ios_base.h:41,
from /usr/include/c++/7/ios:42,
from /usr/include/c++/7/istream:38,
from /usr/include/c++/7/sstream:38,
from /usr/include/c++/7/complex:45,
from /usr/include/c++/7/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
from alternating.cpp:1:
/usr/include/c++/7/bits/basic_string.h:5876:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)
operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
^~~~~~~~
/usr/include/c++/7/bits/basic_string.h:5876:5: note: template argument deduction/substitution failed:
alternating.cpp:30:20: note: 'std::pair<long long int, long long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
a[i].sc=(a[i].sc+n-x)%n+1;
^
In file included from /usr/include/c++/7/string:53:0,
from /usr/include/c++/7/bits/locale_classes.h:40,
from /usr/include/c++/7/bits/ios_base.h:41,
from /usr/include/c++/7/ios:42,
from /usr/include/c++/7/istream:38,
from /usr/include/c++/7/sstream:38,
from /usr/include/c++/7/complex:45,
from /usr/include/c++/7/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
from alternating.cpp:1:
/usr/include/c++/7/bits/basic_string.tcc:1157:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)
operator+(const _CharT* __lhs,
^~~~~~~~
/usr/include/c++/7/bits/basic_string.tcc:1157:5: note: template argument deduction/substitution failed:
alternating.cpp:30:20: note: mismatched types 'const _CharT*' and 'std::pair<long long int, long long int>'
a[i].sc=(a[i].sc+n-x)%n+1;
^
In file included from /usr/include/c++/7/string:53:0,
from /usr/include/c++/7/bits/locale_classes.h:40,
from /usr/include/c++/7/bits/ios_base.h:41,
from /usr/include/c++/7/ios:42,
from /usr/include/c++/7/istream:38,
from /usr/include/c++/7/sstream:38,
from /usr/include/c++/7/complex:45,
from /usr/include/c++/7/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
from alternating.cpp:1:
/usr/include/c++/7/bits/basic_string.tcc:1173:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)
operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs)
^~~~~~~~
/usr/include/c++/7/bits/basic_string.tcc:1173:5: note: template argument deduction/substitution failed:
alternating.cpp:30:20: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'long long int'
a[i].sc=(a[i].sc+n-x)%n+1;
^
In file included from /usr/include/c++/7/string:52:0,
from /usr/include/c++/7/bits/locale_classes.h:40,
from /usr/include/c++/7/bits/ios_base.h:41,
from /usr/include/c++/7/ios:42,
from /usr/include/c++/7/istream:38,
from /usr/include/c++/7/sstream:38,
from /usr/include/c++/7/complex:45,
from /usr/include/c++/7/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
from alternating.cpp:1:
/usr/include/c++/7/bits/basic_string.h:5913:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)
operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
^~~~~~~~
/usr/include/c++/7/bits/basic_string.h:5913:5: note: template argument deduction/substitution failed:
alternating.cpp:30:20: note: 'std::pair<long long int, long long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
a[i].sc=(a[i].sc+n-x)%n+1;
^
In file included from /usr/include/c++/7/string:52:0,
from /usr/include/c++/7/bits/locale_classes.h:40,
from /usr/include/c++/7/bits/ios_base.h:41,
from /usr/include/c++/7/ios:42,
from /usr/include/c++/7/istream:38,
from /usr/include/c++/7/sstream:38,
from /usr/include/c++/7/complex:45,
from /usr/include/c++/7/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
from alternating.cpp:1:
/usr/include/c++/7/bits/basic_string.h:5929:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, _CharT)
operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
^~~~~~~~
/usr/include/c++/7/bits/basic_string.h:5929:5: note: template argument deduction/substitution failed:
alternating.cpp:30:20: note: 'std::pair<long long int, long long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
a[i].sc=(a[i].sc+n-x)%n+1;
^
In file included from /usr/include/c++/7/string:52:0,
from /usr/include/c++/7/bits/locale_classes.h:40,
from /usr/include/c++/7/bits/ios_base.h:41,
from /usr/include/c++/7/ios:42,
from /usr/include/c++/7/istream:38,
from /usr/include/c++/7/sstream:38,
from /usr/include/c++/7/complex:45,
from /usr/include/c++/7/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
from alternating.cpp:1:
/usr/include/c++/7/bits/basic_string.h:5941:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)
operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
^~~~~~~~
/usr/include/c++/7/bits/basic_string.h:5941:5: note: template argument deduction/substitution failed:
alternating.cpp:30:20: note: 'std::pair<long long int, long long int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
a[i].sc=(a[i].sc+n-x)%n+1;
^
In file included from /usr/include/c++/7/string:52:0,
from /usr/include/c++/7/bits/locale_classes.h:40,
from /usr/include/c++/7/bits/ios_base.h:41,
from /usr/include/c++/7/ios:42,
from /usr/include/c++/7/istream:38,
from /usr/include/c++/7/sstream:38,
from /usr/include/c++/7/complex:45,
from /usr/include/c++/7/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
from alternating.cpp:1:
/usr/include/c++/7/bits/basic_string.h:5947:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&)
operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
^~~~~~~~
/usr/include/c++/7/bits/basic_string.h:5947:5: note: template argument deduction/substitution failed:
alternating.cpp:30:20: note: 'std::pair<long long int, long long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
a[i].sc=(a[i].sc+n-x)%n+1;
^
In file included from /usr/include/c++/7/string:52:0,
from /usr/include/c++/7/bits/locale_classes.h:40,
from /usr/include/c++/7/bits/ios_base.h:41,
from /usr/include/c++/7/ios:42,
from /usr/include/c++/7/istream:38,
from /usr/include/c++/7/sstream:38,
from /usr/include/c++/7/complex:45,
from /usr/include/c++/7/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
from alternating.cpp:1:
/usr/include/c++/7/bits/basic_string.h:5953:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&)
operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
^~~~~~~~
/usr/include/c++/7/bits/basic_string.h:5953:5: note: template argument deduction/substitution failed:
alternating.cpp:30:20: note: 'std::pair<long long int, long long int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
a[i].sc=(a[i].sc+n-x)%n+1;
^
In file included from /usr/include/c++/7/string:52:0,
from /usr/include/c++/7/bits/locale_classes.h:40,
from /usr/include/c++/7/bits/ios_base.h:41,
from /usr/include/c++/7/ios:42,
from /usr/include/c++/7/istream:38,
from /usr/include/c++/7/sstream:38,
from /usr/include/c++/7/complex:45,
from /usr/include/c++/7/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
from alternating.cpp:1:
/usr/include/c++/7/bits/basic_string.h:5965:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&)
operator+(const _CharT* __lhs,
^~~~~~~~
/usr/include/c++/7/bits/basic_string.h:5965:5: note: template argument deduction/substitution failed:
alternating.cpp:30:20: note: mismatched types 'const _CharT*' and 'std::pair<long long int, long long int>'
a[i].sc=(a[i].sc+n-x)%n+1;
^
In file included from /usr/include/c++/7/string:52:0,
from /usr/include/c++/7/bits/locale_classes.h:40,
from /usr/include/c++/7/bits/ios_base.h:41,
from /usr/include/c++/7/ios:42,
from /usr/include/c++/7/istream:38,
from /usr/include/c++/7/sstream:38,
from /usr/include/c++/7/complex:45,
from /usr/include/c++/7/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
from alternating.cpp:1:
/usr/include/c++/7/bits/basic_string.h:5971:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&)
operator+(_CharT __lhs,
^~~~~~~~
/usr/include/c++/7/bits/basic_string.h:5971:5: note: template argument deduction/substitution failed:
alternating.cpp:30:20: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'long long int'
a[i].sc=(a[i].sc+n-x)%n+1;
^
In file included from /usr/include/c++/7/string:52:0,
from /usr/include/c++/7/bits/locale_classes.h:40,
from /usr/include/c++/7/bits/ios_base.h:41,
from /usr/include/c++/7/ios:42,
from /usr/include/c++/7/istream:38,
from /usr/include/c++/7/sstream:38,
from /usr/include/c++/7/complex:45,
from /usr/include/c++/7/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
from alternating.cpp:1:
/usr/include/c++/7/bits/basic_string.h:5977:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const _CharT*)
operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
^~~~~~~~
/usr/include/c++/7/bits/basic_string.h:5977:5: note: template argument deduction/substitution failed:
alternating.cpp:30:20: note: 'std::pair<long long int, long long int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
a[i].sc=(a[i].sc+n-x)%n+1;
^
In file included from /usr/include/c++/7/string:52:0,
from /usr/include/c++/7/bits/locale_classes.h:40,
from /usr/include/c++/7/bits/ios_base.h:41,
from /usr/include/c++/7/ios:42,
from /usr/include/c++/7/istream:38,
from /usr/include/c++/7/sstream:38,
from /usr/include/c++/7/complex:45,
from /usr/include/c++/7/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
from alternating.cpp:1:
/usr/include/c++/7/bits/basic_string.h:5983:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, _CharT)
operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
^~~~~~~~
/usr/include/c++/7/bits/basic_string.h:5983:5: note: template argument deduction/substitution failed:
alternating.cpp:30:20: note: 'std::pair<long long int, long long int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
a[i].sc=(a[i].sc+n-x)%n+1;
^
In file included from /usr/include/c++/7/ccomplex:39:0,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
from alternating.cpp:1:
/usr/include/c++/7/complex:326:5: note: candidate: template<class _Tp> std::complex<_Tp> std::operator+(const std::complex<_Tp>&, const std::complex<_Tp>&)
operator+(const complex<_Tp>& __x, const complex<_Tp>& __y)
^~~~~~~~
/usr/include/c++/7/complex:326:5: note: template argument deduction/substitution failed:
alternating.cpp:30:20: note: 'std::pair<long long int, long long int>' is not derived from 'const std::complex<_Tp>'
a[i].sc=(a[i].sc+n-x)%n+1;
^
In file included from /usr/include/c++/7/ccomplex:39:0,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
from alternating.cpp:1:
/usr/include/c++/7/complex:335:5: note: candidate: template<class _Tp> std::complex<_Tp> std::operator+(const std::complex<_Tp>&, const _Tp&)
operator+(const complex<_Tp>& __x, const _Tp& __y)
^~~~~~~~
/usr/include/c++/7/complex:335:5: note: template argument deduction/substitution failed:
alternating.cpp:30:20: note: 'std::pair<long long int, long long int>' is not derived from 'const std::complex<_Tp>'
a[i].sc=(a[i].sc+n-x)%n+1;
^
In file included from /usr/include/c++/7/ccomplex:39:0,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
from alternating.cpp:1:
/usr/include/c++/7/complex:344:5: note: candidate: template<class _Tp> std::complex<_Tp> std::operator+(const _Tp&, const std::complex<_Tp>&)
operator+(const _Tp& __x, const complex<_Tp>& __y)
^~~~~~~~
/usr/include/c++/7/complex:344:5: note: template argument deduction/substitution failed:
alternating.cpp:30:20: note: mismatched types 'const std::complex<_Tp>' an