Submission #220710

# Submission time Handle Problem Language Result Execution time Memory
220710 2020-04-08T12:43:50 Z Vimmer Skandi (COCI20_skandi) C++14
Compilation error
0 ms 0 KB
clude <bits/stdc++.h>

//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("no-stack-protector")

#define F first
#define S second
#define sz(x) int(x.size())
#define pb push_back
#define N 500005
#define MOD ll(998244353)

using namespace std;

typedef long long ll;

typedef long double ld;



int mt[N], idr[505][505][2];

pair <int, int> conv[N][2];

bool lft[N];

set <int> g[N];


bool mk[N], mkr[N], was[N];

bool kuna(int v)
{
    if (mk[v]) return 0;

    mk[v] = 1;

    for (auto it : g[v])
    {
        if (mt[it] == -1 || kuna(mt[it]))
            {
                mt[it] = v;

                was[v] = 1;

                return 1;
            }
    }

    return 0;
}

void dfs(int v, int tp)
{
    mkr[v] = 1;

    if (!tp)
    {
        for (auto it : g[v])
            if (!mkr[it]) dfs(it, 1);
    }
    else if (mt[v] != -1) dfs(mt[v], 0);
}
int main()
{
    ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n, m;

    cin >> n >> m;

    string s[n];

    for (int i = 0; i < n; i++) cin >> s[i];

    int id = 0;

    for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++) {conv[id][0] = {i, j}; idr[i][j][0] = id++; lft[id] = 1; conv[id][1] = {i, j}; idr[i][j][1] = id++;}

    for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++)
          if (s[i][j] == '0')
            {
                int x = i;

                while (s[x][j] == '0') x--;

                int y = j;

                while (s[i][y] == '0') y--;

                g[idr[x][j][1]].insert(idr[i][y][0]);
            }

    memset(mt, -1, sizeof(mt));

    for (int i = 0; i < N; i++)
    {
        if (sz(g[i]) == 0 || was[i]) continue;

        memset(mk, 0, sizeof(mk));

        was[i] = kuna(i);
    }

    vector <pair <pair <int, int>, int> > ans; ans.clear();

    for (int i = 0; i < N; i++) if (mt[i] != -1) g[mt[i]].erase(i);

    for (int i = 0; i < N; i++) if (lft[i] && !was[i])
        dfs(i, 0);

    for (int i = 0; i < N; i++)
    {
        if (lft[i] && !mkr[i]) ans.pb({conv[i][1], 1});

        if (mkr[i] && !lft[i]) ans.pb({conv[i][0], 0});
    }
    cout << sz(ans) << endl;

    for (auto it : ans) cout << it.F.F + 1 << " " << it.F.S + 1 << " " << (it.S == 0 ? "DESNO" : "DOLJE") << endl;
}

Compilation message

skandi.cpp:1:1: error: 'clude' does not name a type
 clude <bits/stdc++.h>
 ^~~~~
skandi.cpp:26:1: error: 'pair' does not name a type
 pair <int, int> conv[N][2];
 ^~~~
skandi.cpp:30:1: error: 'set' does not name a type
 set <int> g[N];
 ^~~
skandi.cpp: In function 'bool kuna(int)':
skandi.cpp:41:20: error: 'g' was not declared in this scope
     for (auto it : g[v])
                    ^
skandi.cpp: In function 'void dfs(int, int)':
skandi.cpp:62:24: error: 'g' was not declared in this scope
         for (auto it : g[v])
                        ^
skandi.cpp: In function 'int main()':
skandi.cpp:69:5: error: 'ios_base' has not been declared
     ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);
     ^~~~~~~~
skandi.cpp:69:35: error: 'istream' has not been declared
     ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);
                                   ^~~~~~~
skandi.cpp:69:64: error: 'cin' was not declared in this scope
     ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);
                                                                ^~~
skandi.cpp:69:64: note: suggested alternative: 'main'
     ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);
                                                                ^~~
                                                                main
skandi.cpp:69:76: error: 'cout' was not declared in this scope
     ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);
                                                                            ^~~~
skandi.cpp:75:5: error: 'string' was not declared in this scope
     string s[n];
     ^~~~~~
skandi.cpp:75:5: note: suggested alternative: 'struct'
     string s[n];
     ^~~~~~
     struct
skandi.cpp:77:40: error: 's' was not declared in this scope
     for (int i = 0; i < n; i++) cin >> s[i];
                                        ^
skandi.cpp:82:38: error: 'conv' was not declared in this scope
         for (int j = 0; j < m; j++) {conv[id][0] = {i, j}; idr[i][j][0] = id++; lft[id] = 1; conv[id][1] = {i, j}; idr[i][j][1] = id++;}
                                      ^~~~
skandi.cpp:82:38: note: suggested alternative: 'long'
         for (int j = 0; j < m; j++) {conv[id][0] = {i, j}; idr[i][j][0] = id++; lft[id] = 1; conv[id][1] = {i, j}; idr[i][j][1] = id++;}
                                      ^~~~
                                      long
skandi.cpp:86:15: error: 's' was not declared in this scope
           if (s[i][j] == '0')
               ^
skandi.cpp:96:17: error: 'g' was not declared in this scope
                 g[idr[x][j][1]].insert(idr[i][y][0]);
                 ^
skandi.cpp:99:5: error: 'memset' was not declared in this scope
     memset(mt, -1, sizeof(mt));
     ^~~~~~
skandi.cpp:103:16: error: 'g' was not declared in this scope
         if (sz(g[i]) == 0 || was[i]) continue;
                ^
skandi.cpp:11:19: note: in definition of macro 'sz'
 #define sz(x) int(x.size())
                   ^
skandi.cpp:110:5: error: 'vector' was not declared in this scope
     vector <pair <pair <int, int>, int> > ans; ans.clear();
     ^~~~~~
skandi.cpp:110:13: error: 'pair' was not declared in this scope
     vector <pair <pair <int, int>, int> > ans; ans.clear();
             ^~~~
skandi.cpp:110:13: note: suggested alternative: 'main'
     vector <pair <pair <int, int>, int> > ans; ans.clear();
             ^~~~
             main
skandi.cpp:110:25: error: expected primary-expression before 'int'
     vector <pair <pair <int, int>, int> > ans; ans.clear();
                         ^~~
skandi.cpp:110:48: error: 'ans' was not declared in this scope
     vector <pair <pair <int, int>, int> > ans; ans.clear();
                                                ^~~
skandi.cpp:112:50: error: 'g' was not declared in this scope
     for (int i = 0; i < N; i++) if (mt[i] != -1) g[mt[i]].erase(i);
                                                  ^
skandi.cpp:119:40: error: 'conv' was not declared in this scope
         if (lft[i] && !mkr[i]) ans.pb({conv[i][1], 1});
                                        ^~~~
skandi.cpp:119:40: note: suggested alternative: 'long'
         if (lft[i] && !mkr[i]) ans.pb({conv[i][1], 1});
                                        ^~~~
                                        long
skandi.cpp:121:40: error: 'conv' was not declared in this scope
         if (mkr[i] && !lft[i]) ans.pb({conv[i][0], 0});
                                        ^~~~
skandi.cpp:121:40: note: suggested alternative: 'long'
         if (mkr[i] && !lft[i]) ans.pb({conv[i][0], 0});
                                        ^~~~
                                        long
skandi.cpp:123:24: error: 'endl' was not declared in this scope
     cout << sz(ans) << endl;
                        ^~~~
skandi.cpp:123:24: note: suggested alternative: 'enum'
     cout << sz(ans) << endl;
                        ^~~~
                        enum
skandi.cpp:125:20: error: unable to deduce 'auto&&' from 'ans'
     for (auto it : ans) cout << it.F.F + 1 << " " << it.F.S + 1 << " " << (it.S == 0 ? "DESNO" : "DOLJE") << endl;
                    ^~~