codeforces#397A Neverending competitions
cf765

where

思考

看成字串中的()

Code

#include <bits/stdc++.h>
using namespace std;
int T, N, M, Q;
string str, ho;
map<string, int> ma;

void ini(void){
  cin>>N>>ho;

  for(int i = 0; i < N; i++){
  
    cin>>str;

    if(str.substr(0, 3) == ho){
      ma[str.substr(5, 3)]++;
    }else{
      ma[str.substr(0, 3)]--;
    }
    
  }
}

bool sol(void){
  map<string, int>::iterator ite;
  
  for(ite = ma.begin(); ite != ma.end(); ite++){
    if(ite->second > 0) return true;
  }
  
  return false;
}

int main(void){
  int i, j;

  ini();

  if(sol()) cout<<"contest"<<endl;
  else cout<<"home"<<endl;

}
*****
Written by Mi on 16 February 2017