Submission #387466

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3874662021-04-08 12:56:13jeroenodbSynchronization (JOI13_synchronization)C++14
50 / 100
306 ms23392 KiB
#include <bits/stdc++.h>
using namespace std;
#define all(x) begin(x),end(x)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pi;
const int mxN = 1e5;
const ll oo = 1e18;
namespace hld {
int n;
int chain[mxN],sz[mxN], parent[mxN],in[mxN], info[mxN], uploaded[mxN] = {};
// vector<edge> edges;
vi adj[mxN];
vector<pi> edges;
set<int,greater<int>> sets[mxN];
int cnt = 0;
void dfs(int at=0, int path=-1) {
int min = in[at] = cnt++;
chain[min] = (path==-1)?min:path;
sets[chain[min]].insert(min);
if(adj[at].empty())
return;
int mx=-2,heavy = -1;
for(int to: adj[at]) {
if(sz[to] > mx) {
mx = sz[to];
heavy=to;
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from synchronization.cpp:1:
synchronization.cpp: In function 'void hld::init(int)':
synchronization.cpp:66:24: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   66 |         assert(q.size()==n);
      |                ~~~~~~~~^~~
synchronization.cpp: In function 'bool hld::update(int)':
synchronization.cpp:84:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   84 |         auto [iter,good] = sets[chain[i]].insert(i);
      |              ^
synchronization.cpp: In function 'int main()':
synchronization.cpp:105:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
  105 |         auto [a,b] = edges[eid];
      |              ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...