QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#545996 | #2616. Attack Order | Lavine# | WA | 1ms | 3664kb | C++23 | 1001b | 2024-09-03 18:45:58 | 2024-09-03 18:45:59 |
Judging History
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]