Submission #332251

#TimeUsernameProblemLanguageResultExecution timeMemory
332251a_playerColors (RMI18_colors)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const int nax=1e5+5; vector<int> grafo[nax]; int a[nax],b[nax]; int ind[nax]; bool cmp(int u, int v){ return a[u]>a[v]; } void solve(){ for(int i=0;i<nax;i++){ grafo[i].clear(); } int n,m; cin>>n>>m; for(int i=0;i<n;i++)cin>>a[i]; for(int i=0;i<n;i++)cin>>b[i]; for(int i=0;i<m;i++){ int u,v; cin>>u>>v; u--,v--; grafo[u].push_back(v); grafo[v].push_back(u); } } iota(ind,ind+n,0); sort(ind,ind+n,cmp); for(int i=0;i<n;i++){ int x=ind[i]; if(a[x]==b[x])continue; for(int j=0;j<n;j++){ if(b[x]==a[j]&&b[x]<=a[x]){ a[x]=b[x]; } } } for(int i=0;i<n;i++)if(a[i]!=b[i]){ cout<<0<<endl; return; } cout<<1<<endl; } int main(){ int tt; cin>>tt; while(tt--)solve(); }

Compilation message (stderr)

colors.cpp:29:7: error: expected constructor, destructor, or type conversion before '(' token
   29 |   iota(ind,ind+n,0);
      |       ^
colors.cpp:30:7: error: expected constructor, destructor, or type conversion before '(' token
   30 |   sort(ind,ind+n,cmp);
      |       ^
colors.cpp:31:3: error: expected unqualified-id before 'for'
   31 |   for(int i=0;i<n;i++){
      |   ^~~
colors.cpp:31:15: error: 'i' does not name a type
   31 |   for(int i=0;i<n;i++){
      |               ^
colors.cpp:31:19: error: 'i' does not name a type
   31 |   for(int i=0;i<n;i++){
      |                   ^
colors.cpp:41:3: error: expected unqualified-id before 'for'
   41 |   for(int i=0;i<n;i++)if(a[i]!=b[i]){
      |   ^~~
colors.cpp:41:15: error: 'i' does not name a type
   41 |   for(int i=0;i<n;i++)if(a[i]!=b[i]){
      |               ^
colors.cpp:41:19: error: 'i' does not name a type
   41 |   for(int i=0;i<n;i++)if(a[i]!=b[i]){
      |                   ^
colors.cpp:46:3: error: 'cout' does not name a type
   46 |   cout<<1<<endl;
      |   ^~~~
colors.cpp:47:3: error: expected declaration before '}' token
   47 |   }
      |   ^