feat(queue): new queue problem formated
This commit is contained in:
33
o-problema-dos-pacotes-viajantes/src/validator.cpp
Normal file
33
o-problema-dos-pacotes-viajantes/src/validator.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "testlib.h"
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
registerValidation(argc, argv);
|
||||
|
||||
int t = inf.readInt(1, 100, "t");
|
||||
inf.readEoln();
|
||||
for (int i = 0; i < t; i++) {
|
||||
int n = inf.readInt(2, 100);
|
||||
inf.readSpace();
|
||||
int s = inf.readInt(1, 100);
|
||||
inf.readSpace();
|
||||
int q = inf.readInt(1, 100);
|
||||
inf.readEoln();
|
||||
|
||||
for (int j = 1; j <= n; j++) {
|
||||
int cargoes = inf.readInt(0, q, "cargoes");
|
||||
for (int k = 1; k <= cargoes; k++) {
|
||||
inf.readSpace();
|
||||
int destination = inf.readInt(1, n, "destination");
|
||||
ensuref(j != destination, "Cargoe cannot have its station as its destination");
|
||||
}
|
||||
inf.readEoln();
|
||||
}
|
||||
}
|
||||
inf.readEof();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user