# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
124744 | arthurconmy | Salesman (IOI09_salesman) | C++14 | 825 ms | 23260 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// check ctrl+v :^)
/* Arthur Conmy IOI template - minimal! */
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <queue>
#include <bitset>
#include <random>
#include <stack>
#include <deque>
#include <chrono>
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int,int>;
#define pb push_back
#define ff first
#define ss second
#define REP(i,a,b) \
for(int i = int(a); i<=int(b); i++)
int n,u,d,s;
ll st[2][1048576]; // first is up, second is down monkaS for memory again!
ll dp[500001];
int query(int l, int r, int tree)
{
ll ans=0;
l+=1048576;
r+=1048576;
l--;
r--;
while(l<=r) // we know there's inequality in the case of the query RMQ(i,i)
{
if(l%2 == 1)
{
ans=max(ans,st[tree][l++]);
}
if(r%2 == 1)
{
ans=max(ans,st[tree][r--]);
}
l/=2;
r/=2;
}
return ans;
}
void update(int pos, ll new_val, int tree)
{
pos+=1048576;
pos--;
st[tree][pos]=max(st[tree][pos],new_val);
pos/=2;
while(pos>0)
{
st[tree][pos] = max(st[tree][pos+pos],st[tree][pos+pos+1]);
pos/=2;
}
}
int main()
{
#ifdef ARTHUR_LOCAL
ifstream cin("input.txt");
#endif
cin>>n>>u>>d>>s;
vector<tuple<int,int,int>> fairs;
REP(i,1,n)
{
int t,l,m;
cin>>t>>l>>m;
fairs.pb({t,l,m});
}
sort(fairs.begin(),fairs.end());
REP(i,0,1000000)
{
st[0][i]+=i;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |