Submission #331984

# Submission time Handle Problem Language Result Execution time Memory
331984 2020-11-30T23:24:11 Z DanerZein Tenis (COCI20_tenis) C++14
0 / 110
1 ms 364 KB
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  map<int,int> bp,bid,nb;
  for(int i=0;i<n;i++) bp[i]=-1;
  for(int i=0;i<n;i++){
    int a; cin>>a;
    a--;
    if(bp[a]==-1){
      bp[a]=i;
      bid[a]=0;
      nb[a]=1;
    }
  }
  for(int i=0;i<n;i++){
    int a; cin>>a;
    a--;
    if(bp[a]>i){
      bp[a]=i;
      bid[a]=1;
      nb[a]=1;
    }
    else
    if(bp[a]==i){
      nb[a]++;
    }
  }
  for(int i=0;i<n;i++){
    int a; cin>>a;
    a--;
    if(bp[a]>i){
      bp[a]=i;
      bid[a]=2;
      nb[a]=1;
    }
    else
      if(bp[a]==i){
	nb[a]++;
      }
  }
  vector<int> c,w;
  c.resize(3);
  w.resize(n);
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      int a,b;
      a=bp[i];
      b=bp[j];
      if(a==b){
	if(nb[i]>nb[j]){
	  w[j]++;
	  c[bid[j]]++;
	}
	else{
	  if(nb[i]==nb[j]){
	    if(bid[i]<bid[j]){
	      w[i]++;
	      c[bid[i]]++;
	    }
	    else{
	      w[j]++;
	      c[bid[j]]++;
	    }
	  }
	  else{
	  w[i]++;
	  c[bid[i]]++;
	  }
	}
      }
      else{
	if(a>b){
	  w[j]++;
	  c[bid[j]]++;
	}
	else{
	  w[i]++;
	  c[bid[i]]++;
	}
      }
    }
  }
  for(int i=0;i<3;i++){
    cout<<c[i]<<" ";
  }
  cout<<endl;
  for(int j=0;j<n;j++){
    cout<<w[j]<<" ";
  }
  cout<<endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -