Submission #136519

# Submission time Handle Problem Language Result Execution time Memory
136519 2019-07-25T12:15:34 Z Nucleist Highway Tolls (IOI18_highway) C++14
0 / 100
27 ms 3640 KB
#include "highway.h"
#include <bits/stdc++.h> 
using namespace std; 
#define flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ll long long
#define INF 1000000000
#define pb push_back
struct greateri
{
    template<class T>
    bool operator()(T const &a, T const &b) const { return a > b; }
};
ll dist[90001];
vector<int>adj[90001];
bool vis[90001];
map<pair<int,int>,int>gg;
map<pair<int,int>,int>gg1;
map<ll,vector<int>>gg2;
ll s,t;
ll s1;
int n,m;
int ma;
void dfs_tree(int node)
{
	dist[node]=s1;
	gg2[s1].pb(node);
	s1+=s;
	vis[node]=1;
	for (int i = 0; i < adj[node].size(); ++i)
	{
		if(vis[adj[node][i]]!=1)
			{	gg[{adj[node][i],node}]=gg1[{min(adj[node][i],node),max(adj[node][i],node)}];
				dfs_tree(adj[node][i]);}
	}
	s1-=s;
}
void find_pair(int N,vector<int>U, vector<int>V, int A, int B)
{
  //flash;
	n=N;
	ma=U.size();
	for (int i = 0; i < ma; ++i)
	{
		int x,y;
		x=U[i];
		y=V[i];
		adj[x].pb(y);
		adj[y].pb(x);
		gg1[{min(x,y),max(x,y)}]=i;
	}
	s=A;
	t=B;
	s1=0;
	//dfs_tree(0);
	vector<int> now(m,0);
	ll vol = ask(now);
	ll kol = vol/s;
	ll nol = kol*t;
	int l = 0;
	int r = ma;
	while (l <= r) {
		fill(now.begin(), now.end(), 0);
        int m = (l+r)/2;
        for (int i = l; i <= m; ++i)
        {
        	now[i]=1;
        }
        ll dol = ask(now);
        if(dol==vol)l=m+1;
        else if(dol!=vol && dol==nol && (m-l)+1==kol){answer(l,m);}
        else if(dol!=vol && dol==nol)r=m;
        else
        {
        	int fal = (dol-vol)/(t-s);
        	answer(m-fal+1,m+(kol-fal));
        }
    }
}
//code the AC sol !
// BS/queue/map

Compilation message

highway.cpp: In function 'void dfs_tree(int)':
highway.cpp:33:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < adj[node].size(); ++i)
                  ~~^~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2428 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2552 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 3404 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2552 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 3640 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 3576 KB Incorrect
2 Halted 0 ms 0 KB -