QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#266376#7741. Countercaolima#AC ✓82ms5188kbC++141.1kb2023-11-26 13:32:062023-11-26 13:32:07

Judging History

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

  • [2023-11-26 13:32:07]
  • 评测
  • 测评结果:AC
  • 用时:82ms
  • 内存:5188kb
  • [2023-11-26 13:32:06]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

const int N=1e5+5;
struct AA
{
    long long x,y;
}a[N];

bool cmp(AA A,AA B)
{
    return A.x<B.x;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long t;
    cin>>t;
    while(t--)
    {
        long long n,m,i;
        cin>>m>>n;
        for(i=0;i<n;i++)
        {
            cin>>a[i].x>>a[i].y;
        }
        a[n].x=a[n].y=0;
        n++;
        sort(a,a+n,cmp);
        for(i=1;i<n;i++)
        {
            if(a[i].x==a[i-1].x&&a[i].y!=a[i-1].y)
            {
                cout<<"No"<<endl;
                goto end;
            }
            if(a[i].y-a[i-1].y==a[i].x-a[i-1].x)
            {
                continue;
            }
            else    
            {
                long long tmp=a[i].x-a[i-1].x-1;
                if(a[i].y>tmp)
                {
                    cout<<"No"<<endl;
                    goto end;
                }
            }
        }
        cout<<"Yes"<<endl;
        end:;
    }
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

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

input:

3
7 4
4 0
2 2
7 1
5 1
3 2
2 2
3 1
3 1
3 100

output:

Yes
No
No

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 37ms
memory: 3748kb

input:

5610
1000000000 9
21408920 21408920
639702953 5628375
678176260 35373514
675909632 33106886
763056067 22659772
634660067 585489
674936674 762263554
637415497 3340919
638759931 4685353
1000000000 9
181850524 41335018
199253466 58737960
991953096 345115785
151207006 10691500
478549434 191746502
105653...

output:

No
No
Yes
Yes
Yes
Yes
No
No
Yes
No
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
No
No
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
No
Yes
No
No
No
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Y...

result:

ok 5610 lines

Test #3:

score: 0
Accepted
time: 82ms
memory: 5188kb

input:

5
1000000000 100000
547678834 188839
397793147 14792
506016255 13227
221799665 127754
599008356 363144
229750198 51359
745400902 120196
199424849 134343
92319760 53188
854824512 110112
836744522 662
731417576 4991
727726496 91833
806187140 65275
106499884 83482
101812456 46836
253971728 117747
27026...

output:

Yes
No
No
Yes
No

result:

ok 5 lines

Test #4:

score: 0
Accepted
time: 78ms
memory: 4428kb

input:

10
1000000000 50000
325131690 27870
495358119 14916
483083615 20903
350409066 752
267334729 567
797038342 21566
985946898 25128
531325143 294
372615334 145
734411884 1455
42395178 3150
55651126 21677
836937065 37580
337422910 9351
716061322 15805
384110398 10055
609169805 574
910889923 49427
3940241...

output:

Yes
No
Yes
Yes
No
No
No
No
Yes
Yes

result:

ok 10 lines

Extra Test:

score: 0
Extra Test Passed