# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
62289 | kriii | Cats or Dogs (JOI18_catdog) | C++17 | 544 ms | 89044 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "catdog.h"
#include <algorithm>
using namespace std;
int N;
vector<int> G[100100]; int P[100100];
const int inf = 1000000000;
struct mat{
mat(long long a, long long b)
{
if (a > inf) a = inf;
if (b > inf) b = inf;
A[0][0] = a; A[0][1] = a+1;
A[1][0] = b+1; A[1][1] = b;
}
mat()
{
A[0][0] = 0; A[0][1] = 1;
A[1][0] = 1; A[1][1] = 0;
}
int A[2][2];
mat operator *(const mat &t) const{
mat r(0,0);
for (int i=0;i<2;i++) for (int j=0;j<2;j++){
r.A[i][j] = inf;
for (int k=0;k<2;k++){
r.A[i][j] = min(r.A[i][j],A[i][k]+t.A[k][j]);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |