mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-14 15:58:47 +00:00
115 lines
2.6 KiB (Stored with Git LFS)
C++
115 lines
2.6 KiB (Stored with Git LFS)
C++
#include <fstream>
|
|
#include <iostream>
|
|
#include <string>
|
|
#include <cctype>
|
|
#include <algorithm>
|
|
#include <cstdio>
|
|
#include <vector>
|
|
|
|
const int maxn = 100010;
|
|
const int maxm = 1000010;
|
|
int n, m;
|
|
int u, v, s, t;
|
|
int p, k;
|
|
int uu, vv;
|
|
|
|
struct Edge {
|
|
int u, v, s, t, c;
|
|
Edge(int u, int v, int w, int t, int c): u(u), v(v), s(s), t(t), c(c) {}
|
|
};
|
|
std::vector<Edge> tab[maxn];
|
|
|
|
int main() {
|
|
// std::ifstream fout("user_out");
|
|
// std::ifstream fans("answer");
|
|
// std::ifstream finp("input");
|
|
|
|
FILE *fout, *fans, *finp;
|
|
fout = fopen("user_out", "r");
|
|
fans = fopen("answer", "r");
|
|
finp = fopen("input", "r");
|
|
|
|
std::string ansstr, outstr;
|
|
char str[100];
|
|
fscanf(fans, "%s", str);
|
|
ansstr = std::string(str);
|
|
fscanf(fout, "%s", str);
|
|
outstr = std::string(str);
|
|
bool ansflag = (ansstr == std::string("NIE"));
|
|
bool outflag = (outstr == std::string("NIE"));
|
|
if(ansflag || outflag) {
|
|
if(ansflag && outflag) {
|
|
std::cerr << "1:Correct answers!" << std::endl;
|
|
std::cout << 100 << std::endl;
|
|
return 0;
|
|
} else {
|
|
std::cerr << "1:Wrong answers!" << std::endl;
|
|
std::cout << 0 << std::endl;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
fscanf(finp, "%d %d", &n, &m);
|
|
for(int i = 0; i < m; i++) {
|
|
fscanf(finp, "%d %d %d %d", &u, &v, &s, &t);
|
|
uu = std::min(u, v);
|
|
vv = std::max(u, v);
|
|
tab[uu].push_back(Edge(uu, vv, s, t, s));
|
|
|
|
}
|
|
|
|
sscanf(outstr.c_str(), "%d", &p);
|
|
if(p > 5 * m || p < 0) {
|
|
std::cerr << "2:Wrong answers!" << std::endl;
|
|
std::cout << 0 << std::endl;
|
|
return 0;
|
|
}
|
|
while(p--) {
|
|
fscanf(fout, "%d %d", &k, &s);
|
|
if(s > n || s <= 0) {
|
|
std::cerr << "3:Wrong answers!" << std::endl;
|
|
std::cout << 0 << std::endl;
|
|
return 0;
|
|
}
|
|
for(int i = 0; i < k; i++) {
|
|
fscanf(fout, "%d", &t);
|
|
if(t > n || t <= 0) {
|
|
std::cerr << "4:Wrong answers!" << std::endl;
|
|
std::cout << 0 << std::endl;
|
|
return 0;
|
|
}
|
|
u = std::min(s, t);
|
|
v = std::max(s, t);
|
|
bool flag = false;
|
|
for(int j = 0; j < tab[u].size(); j++) {
|
|
if(tab[u][j].v == v) {
|
|
flag = true;
|
|
tab[u][j].c = (!tab[u][j].c);
|
|
break;
|
|
}
|
|
}
|
|
if(!flag) {
|
|
std::cerr << u << " " << v<<std::endl;
|
|
std::cerr << "5:Wrong answers!" << std::endl;
|
|
std::cout << 0 << std::endl;
|
|
return 0;
|
|
}
|
|
s = t;
|
|
}
|
|
}
|
|
|
|
for(int i = 1; i <= n; i++) {
|
|
for(int j = 0; j < tab[i].size(); j++) {
|
|
if(tab[i][j].c != tab[i][j].t) {
|
|
std::cerr << i <<' ' << j << std::endl;
|
|
std::cerr << "6:Wrong answers!" << std::endl;
|
|
std::cout << 0 << std::endl;
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
std::cerr << "2:Correct answers!" << std::endl;
|
|
std::cout << 100 << std::endl;
|
|
return 0;
|
|
}
|