Submission #742014

#TimeUsernameProblemLanguageResultExecution timeMemory
742014irmuunBall Machine (BOI13_ballmachine)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define pb push_back #define ll long long #define ff first #define ss second #define all(s) s.begin(),s.end() /* struct segtree{ int n; vector<int>d; segtree(int x){ n=x; d.resize(4*n); build(1,0,n-1); } void build(int node,int l,int r){ if(l==r){ d[node]=0; return; } int mid=(l+r)/2; build(node*2,l,mid); build(node*2+1,mid+1,r); d[node]=d[node*2]+d[node*2+1]; } int query(int node,int l,int r,int L,int R){ if(r<L||R<l||l>r){ return 0; } if(l<=L&&R<=r){ return d[node]; } int mid=(l+r)/2; return query(node*2,l,mid,L,R)+query(node*2+1,mid+1,r,L,R); } void update(int node,int l,int r,int pos,int val){ if(r<pos||pos<l){ return; } if(l==r){ d[node]=val; return; } int mid=(l+r)/2; update(node*2,l,mid,pos,val); update(node*2+1,mid+1,r,pos,val); d[node]=d[node*2]+d[node*2+1]; } };*/ const ll N=1e5+5; vector<int>v[N],adj[N],mn; int n,q,root,used[N],mn[N]; set<int>s; vector<int>ord; void cal(int v){ mn[v]=v; for(auto u:adj[v]){ cal(u); mn[u]=min(mn[u],mn[v]); } } void dfs(int u){ vector<pair<int,int>>p; for(auto v:adj[u]){ p.pb({mn[v],v}); } sort(all(p)); for(auto [val,v]:p){ dfs(u); } ord.pb(u); } void op1(){ int x=*s.begin(); used[x]=1; } void op2(){ } int main(){ cin>>n>>q; for(int i=1;i<=n;i++){ int p; cin>>p; if(p>0){ adj[p-1].pb(i-1); } else{ root=i-1; } } while(q--){ int t; cin>>t; if(t==1){ int k; cin>>k; } else{ int x; cin>>x; x--; op2(x); } } */ }

Compilation message (stderr)

ballmachine.cpp:58:22: error: conflicting declaration 'int mn [100005]'
   58 | int n,q,root,used[N],mn[N];
      |                      ^~
ballmachine.cpp:57:24: note: previous declaration as 'std::vector<int> mn'
   57 | vector<int>v[N],adj[N],mn;
      |                        ^~
ballmachine.cpp: In function 'int main()':
ballmachine.cpp:112:18: error: too many arguments to function 'void op2()'
  112 |             op2(x);
      |                  ^
ballmachine.cpp:84:6: note: declared here
   84 | void op2(){
      |      ^~~
ballmachine.cpp:115:6: error: expected primary-expression before '/' token
  115 |     */
      |      ^
ballmachine.cpp:116:1: error: expected primary-expression before '}' token
  116 | }
      | ^