Untitled
unknown
plain_text
a year ago
2.8 kB
14
Indexable
Never
Bacteria's Family Tree #ifndef _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS #endif #include <stdio.h> #define MAXL (11 + 1) #define CMD_INIT (100) #define CMD_ADD (200) #define CMD_DISTANCE (300) #define CMD_COUNT (400) extern void init(char mAncestor[], int mLastday); extern int add(char mName[], char mParent[], int mFirstday, int mLastday); extern int distance(char mName1[], char mName2[]); extern int count(int mDay); static bool run() { int Q; int ret = -1, ans; bool okay = false; scanf("%d", &Q); for (int q = 0; q < Q; ++q) { int cmd; char mName1[MAXL], mName2[MAXL]; int mDay1, mDay2; scanf("%d", &cmd); switch (cmd) { case CMD_INIT: scanf("%s %d", mName1, &mDay1); init(mName1, mDay1); okay = true; break; case CMD_ADD: scanf("%s %s %d %d", mName1, mName2, &mDay1, &mDay2); ret = add(mName1, mName2, mDay1, mDay2); scanf("%d", &ans); if (ret != ans) okay = false; break; case CMD_DISTANCE: scanf("%s %s", mName1, mName2); ret = distance(mName1, mName2); scanf("%d", &ans); if (ret != ans) okay = false; break; case CMD_COUNT: scanf("%d", &mDay1); ret = count(mDay1); scanf("%d", &ans); if (ret != ans) okay = false; break; default: okay = false; break; } } return okay; } int main() { setbuf(stdout, NULL); // freopen("sample_input.txt", "r", stdin); int TC, MARK; scanf("%d %d", &TC, &MARK); for (int tc = 1; tc <= TC; ++tc) { int score = run() ? MARK : 0; printf("#%d %d\n", tc, score); } return 0; } void init(char mAncestor[], int mDeathday) { return; } int add(char mName[], char mParent[], int mBirthday, int mDeathday) { return 0; } int distance(char mName1[], char mName2[]) { return 0; } int count(int mDay) { return 0; } 25 100 11 100 ancestor 1000 200 childA ancestor 200 800 1 200 childB ancestor 300 1200 1 200 grandchildA childA 250 700 2 300 childB grandchildA 3 200 grandchildB childA 700 1500 2 200 grandchildC childB 800 2000 2 300 ancestor grandchildC 2 300 childB childB 0 400 900 4 400 700 5 37 100 yoqlvn 11026 200 yqk yoqlvn 806 120465 1 200 wpubk yoqlvn 679 573922 1 200 qlpyif wpubk 876 301191 2 200 pctr qlpyif 2053 392840 3 300 yqk pctr 4 400 159174 3 400 379563 2 400 523676 1 400 2051 4 200 iyc wpubk 1023 469300 2 300 yoqlvn qlpyif 2 400 537194 1 400 272003 4 300 pctr wpubk 2 300 yqk wpubk 2 300 qlpyif iyc 2 300 wpubk qlpyif 1 400 218324 4 300 yoqlvn iyc 2 300 qlpyif wpubk 1 300 wpubk wpubk 0 200 eigsfy qlpyif 1003 690675 3 200 ssor pctr 2777 687587 4 200 vgnmp yqk 1405 64205 2 300 vgnmp ssor 6 200 advy yqk 1573 257958 2 300 pctr iyc 3 400 0 1 300 advy wpubk 3 400 221430 7 300 qlpyif advy 4 200 zmqe iyc 1333 162554 3 300 vgnmp pctr 5 300 advy eigsfy 5 300 ssor yqk 5 400 440521 4