Submission #199757

# Submission time Handle Problem Language Result Execution time Memory
199757 2020-02-03T07:24:42 Z SamAnd Checker (COCI19_checker) C++17
0 / 110
1290 ms 75116 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 200005;

int n;
char a[N];
map<int, map<int, int> > c;

int l[N], r[N];

bool stg(int x)
{
    if (c[l[x]].find(r[x]) != c[l[x]].end())
        return true;
}

int main()
{
    scanf("%d", &n);
    scanf("%d", &n);
    scanf(" %s", (a + 1));
    for (int i = 1; i < n; ++i)
    {
        c[i][i + 1] = (a[i] - '0');
        c[i + 1][i] = (a[i] - '0');
    }
    c[n][1] = (a[n] - '0');
    c[1][n] = (a[n] - '0');
    for (int i = 0; i < n - 3; ++i)
    {
        int x, y, z;
        scanf("%d%d%d", &x, &y, &z);
        c[x][y] = z;
        c[y][x] = z;
    }
    for (int i = 1; i < n; ++i)
        r[i] = i + 1;
    r[n] = 1;
    l[1] = n;
    for (int i = 2; i <= n; ++i)
        l[i] = i - 1;
    queue<int> q;
    for (int i = 1; i <= n; ++i)
    {
        if (stg(i))
            q.push(i);
    }
    bool z = true;
    for (int ii = 0; ii < n - 3; ++ii)
    {
        if (q.empty())
        {
            printf("neispravna triangulacija\n");
            return 0;
        }
        int x = q.front();
        q.pop();
        if (!stg(x))
        {
            printf("neispravna triangulacija\n");
            return 0;
        }
        if (c[x][l[x]] == c[x][r[x]] || c[x][l[x]] == c[l[x]][r[x]] || c[x][r[x]] == c[l[x]][r[x]])
            z = false;
        r[l[x]] = r[x];
        l[r[x]] = l[x];
        if (stg(l[x]))
            q.push(l[x]);
        if (stg(r[x]))
            q.push(r[x]);
    }
    //if (!z)
    //    printf("neispravno bojenje\n");
    //else
        printf("tocno\n");
    return 0;
}

Compilation message

checker.cpp: In function 'int main()':
checker.cpp:48:10: warning: variable 'z' set but not used [-Wunused-but-set-variable]
     bool z = true;
          ^
checker.cpp: In function 'bool stg(int)':
checker.cpp:15:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
checker.cpp: In function 'int main()':
checker.cpp:19:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
checker.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
checker.cpp:21:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf(" %s", (a + 1));
     ~~~~~^~~~~~~~~~~~~~~~
checker.cpp:32:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d%d", &x, &y, &z);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Incorrect 6 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Incorrect 6 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1290 ms 71960 KB Output is correct
2 Correct 1281 ms 74872 KB Output is correct
3 Incorrect 1264 ms 74912 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1271 ms 71744 KB Output is correct
2 Correct 1280 ms 75116 KB Output is correct
3 Incorrect 1267 ms 74872 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Incorrect 6 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -