QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#545996#2616. Attack OrderLavine#WA 1ms3664kbC++231001b2024-09-03 18:45:582024-09-03 18:45:59

Judging History

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

  • [2024-09-03 18:45:59]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3664kb
  • [2024-09-03 18:45:58]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std ;
void solve()
{
    int n ;
    cin >> n ;
    vector<int> a(n) , b(n) ;
    for(int i = 0 ; i < n ; i ++)  cin >> a[i] >> b[i] ;
    vector<int> L(n , 1000000000) , R(n , -1) ;
    for(int i = 0 ; i < n ; i ++)
    {
        for(int j = 0 ; j < n ; j ++)
            if(j != i)
            {
                L[i] = min(L[i] , a[i] + b[j]) ;
                R[i] = max(R[i] , a[i] + b[j]) ;
            }
    }
    int flag = 0 ;
    vector<int> id(n , 0) ;
    iota(id.begin() , id.end() , 0) ;
    sort(id.begin() , id.end() , [&](int x , int y){if(L[x]!=L[y])return L[x] < L[y] ; return R[x]<R[y];}) ;
    int lst = -1 ;
    for(auto c : id)
    {
        if(lst > L[c])  flag = 1 ;
        lst = R[c] ;
    }
    if(flag == 0)  cout << "Yes\n" ;
    else  cout << "No\n" ;
}
int main()
{
    std::ios::sync_with_stdio(false) , cin.tie(0) ;

    int T ;
    cin >> T ;
    while (T --)  solve() ;
    return 0 ;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3664kb

input:

3
2
15 25
10 5
3
7 0
7 3
10 0
3
10 10
20 20
30 30

output:

Yes
Yes
No

result:

ok 3 token(s): yes count is 2, no count is 1

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3600kb

input:

1000
4
0 1
0 2
2 2
0 0
4
2 2
1 1
1 1
0 0
4
2 1
1 2
1 0
2 1
3
2 1
1 0
1 1
4
2 0
2 2
1 2
1 2
3
1 0
3 0
0 3
4
1 1
1 0
1 2
1 2
2
1 2
3 1
4
1 2
1 0
2 0
0 2
2
3 3
0 2
4
2 0
1 0
2 1
0 1
3
1 1
1 0
0 3
4
1 1
2 1
0 2
1 1
4
1 2
2 2
1 0
2 1
4
0 0
1 0
0 1
0 1
3
0 1
2 3
0 0
3
3 1
3 2
1 1
4
1 0
0 0
1 1
2 1
4
2 1
1...

output:

No
No
No
Yes
No
No
No
Yes
No
Yes
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
Yes
No
Yes
No
No
Yes
No
No
Yes
No
No
No
Yes
Yes
No
Yes
No
No
No
No
No
Yes
No
No
No
No
No
No
No
Yes
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
Ye...

result:

wrong answer expected NO, found YES [4th token]