QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#773340#9790. Make Swamp Great Againucup-team5319#WA 7ms7572kbC++141.2kb2024-11-23 08:26:212024-11-23 08:26:24

Judging History

This is the latest submission verdict.

  • [2024-11-23 08:26:24]
  • Judged
  • Verdict: WA
  • Time: 7ms
  • Memory: 7572kb
  • [2024-11-23 08:26:21]
  • Submitted

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;
				}
				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;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 5964kb

input:

6
4 7 47 4 77 47

output:

4 6 4 4 5 4 

result:

ok single line: '4 6 4 4 5 4 '

Test #2:

score: 0
Accepted
time: 1ms
memory: 5968kb

input:

6
4 7 47 4 77 47

output:

4 6 4 4 5 4 

result:

ok single line: '4 6 4 4 5 4 '

Test #3:

score: -100
Wrong Answer
time: 7ms
memory: 7572kb

input:

34282
90425 22450 88504 38625 50256 24285 29693 59937 55013 65148 74544 79337 84799 18379 96719 45091 46959 34827 91934 5519 57325 75622 98980 11649 42236 14474 44579 97335 71798 95780 52228 34730 42473 53258 62204 12246 15037 67194 47 41533 22010 29201 65866 68828 26827 16763 76098 73625 5875 92559...

output:

34281 34281 34281 34281 34281 34280 34282 34281 34281 34282 34282 34282 34281 34280 34281 34281 34281 34281 34281 34281 34282 34282 34280 34281 34281 34281 34282 34280 34281 34279 34282 34281 34282 34282 34281 34281 34282 34281 34281 34281 34281 34282 34280 34281 34282 34280 34281 34281 34281 34279 ...

result:

wrong answer 1st lines differ - expected: '34281 34281 34281 34281 34281 ...0 34280 34281 34281 34281 34281', found: '34281 34281 34281 34281 34281 ... 34280 34281 34281 34281 34281 '