QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#116369 | #4883. Bayan Testing | liuzhenhao09 | WA | 1ms | 5624kb | C++14 | 797b | 2023-06-28 16:19:53 | 2023-06-28 16:20:07 |
Judging History
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)