# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
128189 | 2019-07-10T13:48:05 Z | OptxPrime | Minerals (JOI19_minerals) | C++14 | 2 ms | 380 KB |
#include <iostream> #include <cmath> #include<vector> #include <algorithm> #include <utility> #include<stack> #include<queue> #include<map> #include <fstream> #include <minerals.h> using namespace std; #define pb push_back #define mp make_pair #define ll long long #define ans Answer #define query Query bool inside[100010]; int nn; int curr,opencurr,tmp; void conquer( vector<int> vec ) { // cout << " ponovo " <<endl; int sz = vec.size(); if( sz==2 ){ ans( vec[0], vec[1] ); return; } // cout << " ciscenje " <<endl; for( int i=1;i<=2*nn;i++ ){ if( inside[i] ) { query( i ); /// ocistimo prethodno, sporo ciscenje samo za probu inside[i]=false; } } // cout << " gotovo ciscenje " <<endl; int gsz=sz/2; if( gsz%2==1 ) gsz++; int opensz = gsz/2; vector<int>vec1,vec2; vec1.clear(); vec2.clear(); curr=0,opencurr=0; for( int i=0;i<sz;i++ ){ if( vec1.size() >=gsz ){ vec2.pb( vec[i] ); /// ako si popunio prvu grupu samo dodaj na drugu } else{ tmp = query( vec[i] ); inside[ vec[i] ] = true; if( tmp > curr ){ /// zatvorila se neka iz prve grupe vec1.pb( vec[i] ); curr=tmp; } else{ if( opencurr < opensz ){ /// otvorila se neka iz prve grupe vec1.pb( vec[i] ); opencurr++; } else{ ///otvorila se neka iz druge grupe vec2.pb( vec[i] ); curr= query( vec[i] ); inside[ vec[i] ]=false; } } } } /// zaboravio sam ocistit kveri // for( int i=0;i<vec1.size();i++ ) query[ vec[i] ]; /// ovo valjda ocisti kveri ? skontat fino kako se cisti conquer( vec1 ); conquer( vec2 ); } void Solve(int n) { nn=n;///globalno n vector<int>vec; vec.clear(); for ( int i=1;i<=2*n;i++){ vec.pb(i); inside[i]=false; } conquer( vec ); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 380 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 380 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 380 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 380 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 380 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 380 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 380 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 380 KB | Wrong Answer [5] |
2 | Halted | 0 ms | 0 KB | - |