Submission #167759

# Submission time Handle Problem Language Result Execution time Memory
167759 2019-12-10T04:01:41 Z davitmarg Vision Program (IOI19_vision) C++17
44 / 100
1000 ms 9976 KB
/*DavitMarg*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <stack>
#include <cassert>
#include <iterator>
#include <fstream>
#define mod 998244353ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
#define all(v) v.begin(), v.end()
using namespace std;

#ifndef death
#include "vision.h"
#endif

#ifdef death

int add_not(int x)
{
    cout << "add_not " << x << endl;
}

int add_and(vector<int> a)
{
    cout << "add_and ";
    for (int i = 0; i < a.size(); i++)
        cout << a[i] << " ";
    cout << endl;
}

int add_or(vector<int> a)
{
    cout << "add_or ";
    for (int i = 0; i < a.size(); i++)
        cout << a[i] << " ";
    cout << endl;
}

int add_xor(vector<int> a)
{
    cout << "add_xor ";
    for (int i = 0; i < a.size(); i++)
        cout << a[i] << " ";
    cout << endl;
}

#endif

int n, m, k;

int ind(int y, int x)
{
    return y * m + x;
}

int id;
vector<vector<int>> p;

void construct_network(int H, int W, int K)
{
    srand(5578);
    n = H;
    m = W;
    k = K;
    id = n * m;
    vector<int> last;

    vector<pair<int, int>> pos;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++)
            pos.PB(MP(i, j));

    //random_shuffle(all(pos));
    for (int c = 0; c < pos.size() && id - n * m + 1 <= 10000 - 2; c++)
    {
        int i = pos[c].first;
        int j = pos[c].second;
        vector<int> x;
        for (int I = 0; I < n; I++)
            for (int J = 0; J < m; J++)
                if (abs(i - I) + abs(j - J) == k)
                    x.PB(ind(I, J));

        if (x.empty())
            continue;

        add_xor(x);
        id++;

        x.clear();
        x.PB(id - 1);
        x.PB(ind(i, j));

        add_and(x);
        id++;
        last.PB(id - 1);
    }

    add_or(last);
}

#ifdef death

int main()
{
    int N, M, K;
    cin >> N >> M >> K;
    construct_network(N, M, K);
    return 0;
}

#endif

/*
 
 
 
*/

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:88:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int c = 0; c < pos.size() && id - n * m + 1 <= 10000 - 2; c++)
                     ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 392 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 392 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 348 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 2 ms 376 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 2 ms 252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 392 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 348 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 2 ms 376 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 2 ms 252 KB Output is correct
28 Correct 8 ms 632 KB Output is correct
29 Correct 2 ms 256 KB Output is correct
30 Correct 2 ms 256 KB Output is correct
31 Correct 2 ms 348 KB Output is correct
32 Correct 3 ms 428 KB Output is correct
33 Correct 5 ms 504 KB Output is correct
34 Correct 8 ms 740 KB Output is correct
35 Correct 7 ms 632 KB Output is correct
36 Correct 4 ms 376 KB Output is correct
37 Correct 3 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 392 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 348 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 2 ms 376 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 2 ms 252 KB Output is correct
28 Correct 8 ms 632 KB Output is correct
29 Correct 2 ms 256 KB Output is correct
30 Correct 2 ms 256 KB Output is correct
31 Correct 2 ms 348 KB Output is correct
32 Correct 3 ms 428 KB Output is correct
33 Correct 5 ms 504 KB Output is correct
34 Correct 8 ms 740 KB Output is correct
35 Correct 7 ms 632 KB Output is correct
36 Correct 4 ms 376 KB Output is correct
37 Correct 3 ms 376 KB Output is correct
38 Incorrect 141 ms 5792 KB on inputs (58, 84), (89, 65), expected 1, but computed 0
39 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 380 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 19 ms 884 KB Output is correct
4 Correct 33 ms 1912 KB Output is correct
5 Correct 26 ms 1396 KB Output is correct
6 Correct 19 ms 760 KB Output is correct
7 Correct 14 ms 376 KB Output is correct
8 Correct 51 ms 1216 KB Output is correct
9 Correct 89 ms 4040 KB Output is correct
10 Correct 72 ms 2812 KB Output is correct
11 Correct 61 ms 1388 KB Output is correct
12 Correct 50 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 148 ms 1268 KB Output is correct
21 Correct 210 ms 6224 KB Output is correct
22 Correct 181 ms 4176 KB Output is correct
23 Correct 552 ms 632 KB Output is correct
24 Correct 141 ms 1296 KB Output is correct
25 Correct 194 ms 5412 KB Output is correct
26 Correct 527 ms 632 KB Output is correct
27 Correct 273 ms 1608 KB Output is correct
28 Correct 370 ms 9000 KB Output is correct
29 Correct 375 ms 9976 KB Output is correct
30 Correct 338 ms 3252 KB Output is correct
31 Execution timed out 1071 ms 1012 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 272 ms 1492 KB on inputs (80, 199), (81, 199), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 392 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 348 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 2 ms 376 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 2 ms 252 KB Output is correct
28 Correct 8 ms 632 KB Output is correct
29 Correct 2 ms 256 KB Output is correct
30 Correct 2 ms 256 KB Output is correct
31 Correct 2 ms 348 KB Output is correct
32 Correct 3 ms 428 KB Output is correct
33 Correct 5 ms 504 KB Output is correct
34 Correct 8 ms 740 KB Output is correct
35 Correct 7 ms 632 KB Output is correct
36 Correct 4 ms 376 KB Output is correct
37 Correct 3 ms 376 KB Output is correct
38 Incorrect 141 ms 5792 KB on inputs (58, 84), (89, 65), expected 1, but computed 0
39 Halted 0 ms 0 KB -