QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#571162#9308. World Cupsleet1WA 0ms3684kbC++14850b2024-09-17 20:53:272024-09-17 20:53:28

Judging History

你现在查看的是最新测评结果

  • [2024-09-17 20:53:28]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3684kb
  • [2024-09-17 20:53:27]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 2e5+10 ;
//const int mol = ;
int a[N];
void solve(){
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin>>a[i];
	}
	a[n+1] = 0;
	int ans = 0, flag = 1;
	
	while(flag){
		flag = 0;
		for(int i = 1; i <= n; i++){
			if(a[i] < a[i-1] && a[i] < a[i+1]){
				a[i] = min(a[i-1], a[i+1]);
				ans++;
			}else if(a[i] < a[i-1]){
				a[i] = a[i-1];
				ans++;
			}else if(a[i] < a[i+1]){
				a[i] = a[i+1];
				ans++;
			}
//			for(int j = 1; j <= n; j++){
//				cout << a[j] << ' ';
//			}
//			cout << '\n';
			if(i > 1 && a[i] != a[i-1]){
				flag = 1;
			}
		}
	}
	
	cout << ans << '\n';
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	int tt = 1;
	cin>>tt;
	for(int i = 1;i <= tt;i++){
		solve();
	}
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3684kb

input:

1
32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1

output:

31

result:

wrong answer 1st numbers differ - expected: '1', found: '31'