# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1135195 | apark0731 | 정전 (OJUZ10_blackout) | C++20 | 5 ms | 2632 KiB |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, l;
cin >> n >> l;
pair<int, int> a[300100];
int k;
for (int i = 0 ; i < n ; i++){
cin >> k;
if (i%2 == 0){ // a
a[2*i] = {k-l, 1}; //on, k-l is starting point of light
a[2*i+1] = {k+l, -1}; //off, k+l is end point of light
}
else{ //b
a[2*i] = {k-l, 2}; //on
a[2*i+1] = {k+l, -2}; //off
}
}
sort(&a[0], &a[2*n]);
for (int i = 0 ; i < 2*n ; i++){
//cout << a[i].first << " " << a[i].second << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |