QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#780934 | #9790. Make Swamp Great Again | AClove | WA | 0ms | 6712kb | C++14 | 1.1kb | 2024-11-25 14:05:21 | 2024-11-25 14:05:21 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e5 + 114;
int n;
int a[N];
vector <int> v[N];
int ans[N];
int to(int x) { return a[(x - 1) % n + 1]; }
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
for(int i = 1; i <= n; i = i + 1)
{
cin >> a[i];
v[a[i]].push_back(i);
}
for(int i = 1; i <= n; i = i + 1)
{
int res = n - v[a[i]].size();
bool flag = 1;
for(auto j : v[a[i]])
{
if(flag == 0)
break;
if(max(max(to(j), to(j + 1)), to(j + 2)) == to(j) || min(min(to(j), to(j + 1)), to(j + 2)) == to(j))
flag = 0;
if(max(max(to(j - 1), to(j)), to(j + 1)) == to(j) || min(min(to(j - 1), to(j)), to(j + 1)) == to(j))
flag = 0;
if(max(max(to(j - 2), to(j - 1)), to(j)) == to(j) || min(min(to(j - 2), to(j - 1)), to(j)) == to(j))
flag = 0;
}
cout << res + flag << " ";
}
cout << "\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 6712kb
input:
6 4 7 47 4 77 47
output:
4 5 4 4 5 4
result:
wrong answer 1st lines differ - expected: '4 6 4 4 5 4', found: '4 5 4 4 5 4 '