QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#116369#4883. Bayan Testingliuzhenhao09WA 1ms5624kbC++14797b2023-06-28 16:19:532023-06-28 16:20:07

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-28 16:20:07]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5624kb
  • [2023-06-28 16:19:53]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
struct node{
	int len,l,r;
	bool operator <(const node& kkk)const{
		return len < kkk.len;
	}
}a[100010];
int T;
int n,m;
int ans[200010];
signed main(){
	scanf("%lld",&T);
	while(T--){
		scanf("%lld %lld",&n,&m);
		for(int i = 1,l,r; i <= 2 * m; i++){
			scanf("%lld %lld",&l,&r);
			a[i].len = r - l + 1;
			a[i].l = l;
			a[i].r = r;
		}
		sort(a + 1,a + 2 * m + 1);
		int d = a[m + 1].len,R = a[m + 1].r;
		if(d == 1){
			printf("-1\n");
			continue;
		}
		for(int i = 1; i <= d; i++) ans[i] = i;
		for(int i = d + 1; i < R; i++) ans[i] = ans[i - d];
		for(int i = R; i <= n; i++) ans[i] = ans[i - d + 1];
		for(int i = 1; i <= n; i++) printf("%lld ",ans[i]);
		printf("\n");
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 5624kb

input:

3
2 1
1 1
2 2
6 2
1 3
4 6
2 4
3 5
4 3
1 2
1 1
2 2
2 3
3 3
3 4

output:

-1
1 2 3 2 3 2 
1 1 1 1 

result:

wrong answer the number of segments with two equal elements is 3 != 2 (test case 2)