QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#888063 | #9920. Money Game 2 | ucup-team5008 | Compile Error | / | / | C++23 | 2.6kb | 2025-02-07 21:50:35 | 2025-02-07 21:50:35 |
Judging History
This is the latest submission verdict.
- [2025-02-07 21:50:35]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2025-02-07 21:50:35]
- Submitted
answer
#include<bits/stdc++.h>
using namespace std;
#define rep2(i,j,k) for(ll i=ll(j);i<ll(k);i++)
#define rep(i,j) rep2(i,0,j)
#define rrep2(i,j,k) for(ll i=ll(j)-1;i>=ll(k);i--)
#define rrep(i,j) rrep2(i,j,0)
#define SZ(a) ll(a.size())
#define eb emplace_back
#define all(a) a.begin(),a.end()
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using vp=vector<P>;
using vvp=vector<vp>;
const ll inf=LLONG_MAX/4;
template<class T>
bool chmin(T& a,T b){return a>b?a=b,1:0;}
template<class T>
bool chmax(T& a,T b){return a<b?a=b,1:0;}
void print(vl v){for(auto el:v) cout<<el<<" ";cout<<"\n";}
void solve(){
ll n;cin>>n;
vl a(n);
rep(i,n) cin>>a[i];
if(n<=1000){
vl ans(n,-inf);
rep(i,n){
vl add=a;
ll now;
now=i;
ll carry=0;
do{
add[now]+=carry;
carry+=a[now];
carry/=2;
now=(now+1)%n;
}while(now!=i);
now=(i+n-1)%n;
carry=0;
do{
add[now]+=carry;
carry+=a[now];
carry/=2;
now=(now+n-1)%n;
}while(now!=(i+n-1)%n);
rep(j,n) chmax(ans[j],add[j]);
}
print(ans);
return;
}
const ll M=40;
vvl table(2,vl(n,-inf));
vvl las(2,vl(n,-inf));
vvl value(2,vl(n));
rep(i,2){
auto mem=a;
rep(j,n) a.eb(a[j]);
vvl sum(2*n,vl(M));
vl last(2*n);
rep(j,2*n){
rep(k,M){
if(j>=k) sum[j][k]=(a[j-k]>>(k+1));
}
rep(k,M-1) sum[j][k+1]+=sum[j][k];
last[j]=j;
rrep(k,M-1){
if(sum[j][k+1]!=sum[j][k]){
last[j]=j-k;
break;
}
}
}
vl ok(2*n,-inf);
rep(j,2*n){
if(a[j%n]/2%2==0) continue;
rep2(k,1,M){
if(j+k>=2*n) break;
if(a[(j+k)%n]%2==0) break;
if(j+k>=n&&j<=las[j+k]) chmax(table[i][(j+k)-n],j-n);
if(k==M-1) chmax(ok[j+k],j);
}
}
rep2(j,n,2*n){
value[i][j-n]=sum[j][M-1];
}
las[i]=last;
rep(j,2*n-1) if(a[(j+1)%n]%2) chmax(ok[j+1],ok[j]);
rep2(j,n,2*n) chmax(table[i][j-n],ok[j]-n);
rep(j,n) table[i][j]=j-table[i][j]+1;
rep(j,n) las[i][j]=j-las[i][j]+1;
a=mem;
reverse(all(a));
}
// reverse(all(table[1]));
// reverse(all(las[1]));
// reverse(all(value[1]));
vl ans(n);
rep(i,n){
ll l=(i+n-1)%n;
ll r=(i+1)%n;
r=n-1-r;
ll left=table[0][l];
ll right=table[1][r];
ans[i]=a[i]+value[0][l]+value[1][r];
// cout<<left<<" "<<right<<" "<<las[0][l]<<" "<<las[1][r]<<endl;
if(left+las[1][r]<=n-1){
if(left+right<=n-1) ans[i]+=2;
else ans[i]++;
}
else if(right+las[0][l]<=n-1) ans[i]++;
}
print(ans);
return;
}
int main(){
cin.tie(0)->sync_with_stdio(0);
ll t;cin>>t;
while(t--) solve();
}
详细
answer.code: In function ‘void solve()’: answer.code:82:45: error: no match for ‘operator<=’ (operand types are ‘ll’ {aka ‘long long int’} and ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type’ {aka ‘std::vector<long long int>’}) 82 | if(j+k>=n&&j<=las[j+k]) chmax(table[i][(j+k)-n],j-n); In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from answer.code:1: /usr/include/c++/14/bits/regex.h:1288:5: note: candidate: ‘template<class _Bi_iter, class _Ch_traits, class _Alloc> auto std::__cxx11::operator<=>(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)’ (reversed) 1288 | operator<=>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1288:5: note: template argument deduction/substitution failed: answer.code:82:54: note: ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type’ {aka ‘std::vector<long long int>’} is not derived from ‘const std::__cxx11::sub_match<_BiIter>’ 82 | if(j+k>=n&&j<=las[j+k]) chmax(table[i][(j+k)-n],j-n); | ^ /usr/include/c++/14/bits/regex.h:1456:5: note: candidate: ‘template<class _Bi_iter> auto std::__cxx11::operator<=>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)’ (reversed) 1456 | operator<=>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1456:5: note: template argument deduction/substitution failed: answer.code:82:54: note: ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type’ {aka ‘std::vector<long long int>’} is not derived from ‘const std::__cxx11::sub_match<_BiIter>’ 82 | if(j+k>=n&&j<=las[j+k]) chmax(table[i][(j+k)-n],j-n); | ^ /usr/include/c++/14/bits/regex.h:1629:5: note: candidate: ‘template<class _Bi_iter> auto std::__cxx11::operator<=>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)’ (reversed) 1629 | operator<=>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1629:5: note: template argument deduction/substitution failed: answer.code:82:54: note: ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type’ {aka ‘std::vector<long long int>’} is not derived from ‘const std::__cxx11::sub_match<_BiIter>’ 82 | if(j+k>=n&&j<=las[j+k]) chmax(table[i][(j+k)-n],j-n); | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1023:5: note: candidate: ‘template<class _T1, class _T2, class _U1, class _U2> constexpr std::common_comparison_category_t<decltype (std::__detail::__synth3way(declval<_T1&>(), declval<_U1&>())), decltype (std::__detail::__synth3way(declval<_T2&>(), declval<_U2&>()))> std::operator<=>(const pair<_T1, _T2>&, const pair<_U1, _U2>&)’ (reversed) 1023 | operator<=>(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1023:5: note: template argument deduction/substitution failed: answer.code:82:54: note: ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type’ {aka ‘std::vector<long long int>’} is not derived from ‘const std::pair<_T1, _T2>’ 82 | if(j+k>=n&&j<=las[j+k]) chmax(table[i][(j+k)-n],j-n); | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:576:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> requires three_way_comparable_with<_IteratorR, _IteratorL, std::partial_ordering> constexpr std::compare_three_way_result_t<_IteratorL, _IteratorR> std::operator<=>(const reverse_iterator<_IteratorL>&, const reverse_iterator<_IteratorR>&)’ (reversed) 576 | operator<=>(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:576:5: note: template argument deduction/substitution failed: answer.code:82:54: note: ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type’ {aka ‘std::vector<long long int>’} is not derived from ‘const std::reverse_iterator<_IteratorL>’ 82 | if(j+k>=n&&j<=...