QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#501094 | #5159. Justice Served | Abcl | TL | 0ms | 3652kb | C++14 | 851b | 2024-08-02 14:03:42 | 2024-08-02 14:03:44 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=200005;
int n;
vector<pair<int,int> > nums;
int ans[N];
int maxl=0;
void solve(){
cin>>n;
for(int i=1,a,t;i<=n;i++){
cin>>a>>t;
nums.emplace_back(make_pair(a,t));
}
for(int i=1;i<n;i++){
int p=0;
for(int j=0;j<i;j++){
if(nums[i].first<nums[j].first)continue;
if(nums[i].first+nums[i].second<=nums[j].first+nums[j].second){
p++;
}
if(p>maxl)break;
}
if(p>maxl)ans[i]=++maxl;
else ans[i]=p;
}
for(int i=0;i<n;i++){
if(i==0)cout<<ans[i];
else cout<<" "<<ans[i];
}
return;
}
signed main() {
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
int T_case=1;
//cin>>T_case;
while(T_case--){
solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3648kb
input:
4 2 8 1 7 4 5 5 2
output:
0 0 1 2
result:
ok single line: '0 0 1 2'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
5 2 4 3 3 2 2 4 2 4 1
output:
0 1 1 2 3
result:
ok single line: '0 1 1 2 3'
Test #3:
score: -100
Time Limit Exceeded
input:
200000 75760147 173015388 62879760 211229046 6728658 106668560 29476341 129401393 30531505 130450085 39792769 139780734 59486082 221617335 12447225 112582555 94207716 117434450 68962063 193352291 13519090 113644734 60611935 218232526 77901558 166662816 40316254 140281744 39094390 138994435 49921965 ...