Submission #223467

# Submission time Handle Problem Language Result Execution time Memory
223467 2020-04-15T09:40:18 Z maomao90 Checker (COCI19_checker) C++14
0 / 110
3000 ms 31608 KB
#include <cstdio>
#include <algorithm>
#include <utility>
#include <map>
#include <tuple>
#include <cmath>

using namespace std;

typedef pair <int, int> ii;
typedef pair <ii, int> iii;

int tc;
int N;
int colours[200005];
iii diagonals[200005];
map <ii, int> dColours;
bool isInvalid[200005];

bool comp(iii right, iii left)
{
    int rx, ry, lx, ly;
    tie(rx, ry) = right.first; tie(lx, ly) = left.first;
    if (abs(rx - ry) < abs(lx - ly)) return true;
    else if (abs(rx - ry) == abs(lx - ly))
    {
        if (rx < ry) return true;
    }
    return false;
}

int main()
{
    scanf("%d%d", &tc, &N);
    for (int i = 1; i <= N; i++)
    {
        char temp; scanf(" %c", &temp);
        colours[i] = temp - '0';
    }
    for (int i = 0; i < N - 3; i++)
    {
        int X, Y, C; scanf("%d%d%d", &X, &Y, &C);
        if (X > Y) swap(X, Y);
        diagonals[i] = iii(ii(X, Y), C);
        dColours[ii(X, Y)] = C;
        dColours[ii(Y, X)] = C;
    }
    sort(diagonals, diagonals + N - 3, comp);
    for (int i = 0; i < N - 3; i++)
    {
        int x, y, c;
        tie(x, y) = diagonals[i].first; c = diagonals[i].second;
        if (isInvalid[x] || isInvalid[y])
        {
            printf("neispravna triangulacija\n");
            return 0;
        }
        for (int j = x + 1; j < y; j++) isInvalid[j] = true;
    }
    printf("tocno\n");
    return 0;
}

Compilation message

checker.cpp: In function 'int main()':
checker.cpp:51:19: warning: variable 'c' set but not used [-Wunused-but-set-variable]
         int x, y, c;
                   ^
checker.cpp:34:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &tc, &N);
     ~~~~~^~~~~~~~~~~~~~~~~
checker.cpp:37:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         char temp; scanf(" %c", &temp);
                    ~~~~~^~~~~~~~~~~~~~
checker.cpp:42:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         int X, Y, C; scanf("%d%d%d", &X, &Y, &C);
                      ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Incorrect 5 ms 384 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Incorrect 5 ms 384 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3089 ms 31608 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3093 ms 31608 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Incorrect 5 ms 384 KB Output isn't correct
6 Halted 0 ms 0 KB -