# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
636972 | 2022-08-30T22:08:24 Z | Metal_Sonic | Unija (COCI17_unija) | C++17 | 251 ms | 54432 KB |
#include <bits/stdc++.h> #include<ext/pb_ds/tree_policy.hpp> #include<ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; using namespace __gnu_cxx; template<class T> using indexed_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>; #define ll long long #define sz(x) (int)(x).size() #define all(x) x.begin() , x.end() void Sonic(string name = "") { ios_base::sync_with_stdio(false); cin.tie(nullptr); if(sz(name)){ freopen((name+".in").c_str(), "r", stdin); freopen((name+".out").c_str(), "w", stdout); } } int xd[] = {0, 0, 1, -1, 1, 1, -1, -1}; int yd[] = {1, -1, 0, 0, 1, -1, 1, -1}; const int mxn = 1e7+5; void run_test_case(){ int n;cin>>n; vector<int>ans(mxn,0); for(int i = 0; i < n; i++){ int x,y;cin>>x>>y; ans[x/2]=max(ans[x/2],y); } ll res = 0; for(int i = mxn; i >= 1; i--){ ans[i] = max(ans[i],ans[i+1]); res+=ans[i]; } cout<<res*2; } int main(){ Sonic(); int T = 1; //cin>>T; while(T--){ run_test_case(); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 48 ms | 39380 KB | Output is correct |
2 | Correct | 49 ms | 39360 KB | Output is correct |
3 | Correct | 49 ms | 39432 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 48 ms | 39432 KB | Output is correct |
2 | Correct | 47 ms | 39380 KB | Output is correct |
3 | Correct | 50 ms | 39384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 48 ms | 39392 KB | Output is correct |
2 | Correct | 48 ms | 39424 KB | Output is correct |
3 | Correct | 47 ms | 39388 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 49 ms | 39412 KB | Output is correct |
2 | Correct | 51 ms | 39380 KB | Output is correct |
3 | Correct | 50 ms | 39380 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 246 ms | 39380 KB | Output is correct |
2 | Correct | 222 ms | 39408 KB | Output is correct |
3 | Correct | 251 ms | 39380 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 48 ms | 39444 KB | Output is correct |
2 | Correct | 48 ms | 39380 KB | Output is correct |
3 | Correct | 48 ms | 39400 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 52 ms | 39456 KB | Output is correct |
2 | Correct | 56 ms | 39784 KB | Output is correct |
3 | Correct | 53 ms | 39740 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 68 ms | 39412 KB | Output is correct |
2 | Correct | 63 ms | 40716 KB | Output is correct |
3 | Correct | 63 ms | 40844 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 93 ms | 39448 KB | Output is correct |
2 | Correct | 96 ms | 43408 KB | Output is correct |
3 | Correct | 98 ms | 43416 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 237 ms | 39380 KB | Output is correct |
2 | Correct | 250 ms | 54432 KB | Output is correct |
3 | Correct | 246 ms | 54348 KB | Output is correct |