QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#777513 | #9790. Make Swamp Great Again | ucup-team1134# | WA | 6ms | 8000kb | C++23 | 1.5kb | 2024-11-24 02:45:02 | 2024-11-24 02:45:02 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define vll vector<pair<ll,ll>>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define vvii vector<vector<pair<int,int>>>
#define vvll vector<vector<pair<ll,ll>>>
#define vst vector<string>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define mkunique(x) sort(all(x));(x).erase(unique(all(x)),(x).end())
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=300005,INF=15<<26;
int main(){
std::ifstream in("text.txt");
std::cin.rdbuf(in.rdbuf());
cin.tie(0);
ios::sync_with_stdio(false);
ll N;cin>>N;
vl A(N),S(MAX),F(MAX);
for(int i=0;i<N;i++){
cin>>A[i];
S[A[i]]++;
}
for(int i=0;i<N;i++){
ll x=A[i];
ll ans=N-S[x];
ll a=A[(i+N-1)%N],b=A[(i+1)%N];
if(a<x&&x<b) ans++;
else if(b<x&&x<a) ans++;
else F[x]=true;
}
for(int i=0;i<N;i++){
ll x=A[i];
ll ans=N-S[x];
if(!F[x]) ans++;
cout<<ans<<" ";
}
cout<<endl;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 7800kb
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: 0ms
memory: 7864kb
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: 6ms
memory: 8000kb
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 '