# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1174729 | Ciprian | Lightning Rod (NOI18_lightningrod) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pi pair<int,int>
int32_t main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin>>n;
vector<pi>p;
for(int i=0; i<n;i++){
int x,y;
cin>>x>>y;
p.push_back({y,x});
}sort(p.rbegin(), p.rend());
vector<pi>light;
int ind=0;
while(ind<n){
if(light.size()==0){
light.push_back(p[ind]);
}else{
bool check=false;
for(auto e: light){
if(abs(e.second-p[ind].second)<=e.first-p[ind].first){
check=true;
break;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |