# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
370177 |
2021-02-23T14:27:30 Z |
Atill83 |
Unija (COCI17_unija) |
C++14 |
|
1000 ms |
41708 KB |
#include <bits/stdc++.h>
#define ff first
#define ss second
#define endl '\n'
using namespace std;
const long long INF = (long long) 1e18;
const int mod = (int) 1e9+7;
const int MAXN = (int) 3e5+5;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll n;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);cout.tie(nullptr);
#ifdef Local
freopen("C:/Users/Admin/Desktop/Yazilim/C/IO/int.txt","r",stdin);
freopen("C:/Users/Admin/Desktop/Yazilim/C/IO/out.txt","w",stdout);
#endif
cin>>n;
set<pii> st;
for(int i = 0; i < n; i++){
int x, y;
cin>>x>>y;
x /= -2;
y /= 2;
auto u = st.lower_bound({x, mod});
while(u != st.end() && (*u).ss <= y)
u = st.erase(u);
if(u != st.begin() && (*prev(u)).ss >= y)
continue;
st.insert({x, y});
}
ll pos = -mod, ans = 0, heg = 0;
for(auto u = st.begin(); u != st.end(); u++){
ll ex = ((*u).ff - pos) * heg;
ans += ex;
heg = (*u).ss;
pos = (*u).ff;
}
ans += -pos*heg;
cout<<4*ans<<endl;
#ifdef Local
cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds ";
#endif
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
492 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
492 KB |
Output is correct |
2 |
Correct |
3 ms |
492 KB |
Output is correct |
3 |
Correct |
3 ms |
492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1083 ms |
41708 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
748 KB |
Output is correct |
2 |
Correct |
8 ms |
748 KB |
Output is correct |
3 |
Correct |
6 ms |
748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
1644 KB |
Output is correct |
2 |
Correct |
22 ms |
1644 KB |
Output is correct |
3 |
Correct |
22 ms |
1772 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
61 ms |
4332 KB |
Output is correct |
2 |
Correct |
61 ms |
4360 KB |
Output is correct |
3 |
Correct |
76 ms |
4460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
219 ms |
15468 KB |
Output is correct |
2 |
Correct |
220 ms |
15340 KB |
Output is correct |
3 |
Correct |
222 ms |
15468 KB |
Output is correct |