QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#432858#6708. Elevator Stopping Plansurenjamts#WA 0ms3776kbC++14700b2024-06-07 19:08:362024-06-07 19:08:37

Judging History

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

  • [2024-06-07 19:08:37]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3776kb
  • [2024-06-07 19:08:36]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std; 
#define int long long
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	int n;
	while(1){
		cin>>n;
		if(n==0) return 0;
		int a[n+5];
		int idx=1;
		for(int i=1; i<=n; i++){
			cin>>a[i];
		}
		sort(a+1,a+n+1);
		int q=4*(a[n]-1);
		vector<int> v;
		int ans=0;
		for(int i=1; i<=n; i++){
			if(q+10<(a[i]-idx)*20){
				q+=10;
				ans=max(ans,q);
				v.push_back(a[i]);
				idx=a[i];
			}
			else{
				ans=max(ans,(a[i]-idx)*20);
			}
		}
		cout<<ans-10<<endl;
		cout<<v.size()<<" ";
		for(int i=0; i<v.size(); i++){
			cout<<v[i];
			if(i!=v.size()-1){
				cout<<" ";
			}
		}
		cout<<endl;
	}	
 
	
	
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 4 5 10
1 2
0

output:

46
2 4 10
4
1 2

result:

ok correct (2 test cases)

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3548kb

input:

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

output:

4
1 2
36
1 10
76
1 20
120
1 31
36
1 10
120
1 31
130
2 10 31
86
2 10 20
130
2 15 31
126
2 10 30
26
2 3 5
50
2 7 11
78
2 13 18
110
1 20
70
2 6 12
130
2 9 28
130
2 8 31
136
3 8 16 24
140
3 9 17 25
136
3 8 21 29
140
3 8 16 24

result:

wrong answer  (test case 11)