QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#773354 | #9790. Make Swamp Great Again | ucup-team5319# | Compile Error | / | / | C++17 | 1.4kb | 2024-11-23 08:28:41 | 2024-11-23 08:28:46 |
Judging History
answer
//Linkwish's code
#include<bits/stdc++.h>
#define endl '\n'
#define si inline
#define fi first
#define se second
using namespace std;
typedef long long ll;typedef __int128 li;typedef long double ld;
typedef pair<int,int> pii;typedef pair<ll,ll> pll;
typedef const int ci;typedef const ll cl;ci iinf=INT_MAX;cl linf=LLONG_MAX;
template<typename T>si bool gmax(T &x,const T y){if(x<y)return x=y,1;return 0;}
template<typename T>si bool gmin(T &x,const T y){if(y<x)return x=y,1;return 0;}
namespace LinkWish{
ci N=100005,lim=1e5;
int n,a[N];
vector<int> p[N];
int ans[N];
void mian(){
cin>>n;
map<int,int> t;
for(int i=0;i<n;i++)cin>>a[i],p[a[i]].push_back(i);
for(int i=1;i<=lim;i++){
if(!p[i].empty()){
bool flag=false;
for(int j:p[i]){
auto [x,y]=minmax({a[(j+n-1)%n],a[j],a[(j+1)%n]});
if(x==i||y==i)flag=true;
auto [x,y]=minmax({a[(j+n-1)%n],a[j],a[(j+n-2)%n]});
if(x==i||y==i)flag=true;
auto [x,y]=minmax({a[(j+2)%n],a[j],a[(j+1)%n]});
if(x==i||y==i)flag=true;
}
if(!flag)ans[i]=n-p[i].size()+1;
else ans[i]=n-p[i].size();
}
}
for(int i=0;i<n;i++)cout<<ans[a[i]]<<' ';
cout<<endl;
}
}
signed main(){
#ifndef ONLINE_JUDGE
assert(freopen("in.in","r",stdin));
assert(freopen("out.out","w",stdout));
#endif
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
LinkWish::mian();
return 0;
}
Details
answer.code: In function ‘void LinkWish::mian()’: answer.code:34:47: error: conflicting declaration ‘auto x’ 34 | auto [x,y]=minmax({a[(j+n-1)%n],a[j],a[(j+n-2)%n]}); | ^ answer.code:32:47: note: previous declaration as ‘std::tuple_element<0, std::pair<int, int> >::type&& x’ 32 | auto [x,y]=minmax({a[(j+n-1)%n],a[j],a[(j+1)%n]}); | ^ answer.code:34:49: error: conflicting declaration ‘auto y’ 34 | auto [x,y]=minmax({a[(j+n-1)%n],a[j],a[(j+n-2)%n]}); | ^ answer.code:32:49: note: previous declaration as ‘std::tuple_element<1, std::pair<int, int> >::type&& y’ 32 | auto [x,y]=minmax({a[(j+n-1)%n],a[j],a[(j+1)%n]}); | ^ answer.code:36:47: error: conflicting declaration ‘auto x’ 36 | auto [x,y]=minmax({a[(j+2)%n],a[j],a[(j+1)%n]}); | ^ answer.code:32:47: note: previous declaration as ‘std::tuple_element<0, std::pair<int, int> >::type&& x’ 32 | auto [x,y]=minmax({a[(j+n-1)%n],a[j],a[(j+1)%n]}); | ^ answer.code:36:49: error: conflicting declaration ‘auto y’ 36 | auto [x,y]=minmax({a[(j+2)%n],a[j],a[(j+1)%n]}); | ^ answer.code:32:49: note: previous declaration as ‘std::tuple_element<1, std::pair<int, int> >::type&& y’ 32 | auto [x,y]=minmax({a[(j+n-1)%n],a[j],a[(j+1)%n]}); | ^