Skip to content

Instantly share code, notes, and snippets.

@diego9627
Created October 24, 2012 06:40
Show Gist options
  • Save diego9627/3944412 to your computer and use it in GitHub Desktop.
Save diego9627/3944412 to your computer and use it in GitHub Desktop.
Amigos
#include<iostream>
#include<cstdio>
#include<map>
using namespace std;
int amistades[1000][1000];
int main(){
int N,j,i,P;
string nombre,nombre2;
map<string,int> enumeracion;
map<string,int>::iterator it;
scanf("%d \n",&N);
for(i=0;i<N;i++){
getline(cin,nombre);
enumeracion[nombre]=i;
}
for(i=0;i<N;i++) for(j=0;j<N;j++) scanf("%d \n",&amistades[i][j]);
scanf("%d \n",&P);
for(i=0;i<P;i++){
getline(cin,nombre);
getline(cin,nombre2);
printf("%d\n",amistades[enumeracion[nombre]][enumeracion[nombre2]]);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment