/* Contest: Southwestern European Regionals 1997 * Problem: Island of Logic * Author : Mark Dettinger */ #include #include #include #define DIVINE 1 #define EVIL 2 #define HUMAN 4 #define NOTDIVINE 6 #define NOTEVIL 5 #define NOTHUMAN 3 #define ANYTHING 7 #define LYING 8 #define NOTLYING 16 #define DAY 1 #define NIGHT 2 #define UNKNOWN 3 #define NATURE -1 #define MAX(a,b) ((a)>(b)?(a):(b)) #define DBG(x) typedef struct { int who; /* who made the statement? */ int about; /* about whom? */ int what; /* what did he say about him? */ } statement; FILE *input; int kase=0; statement st[100]; int numstatements; /* number of statements given */ int numpeople; /* number of people involved */ int time; /* current time: day or night */ int status[20]; /* status[i] = status of person i */ int time_possible; /* possible values for time */ int possible[20]; /* possible races for people */ int solutions; /* number of worlds consistent with statements */ int read_case() { char line[100],what[20],who,about; int i; fscanf(input,"%d ",&numstatements); if (numstatements==0) return 0; numpeople = 0; for (i=0; i