답안 #167761

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
167761 2019-12-10T04:03:24 Z davitmarg Vision Program (IOI19_vision) C++17
44 / 100
289 ms 2540 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(9896);
    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 && ind(i, j) > ind(I, J))
                    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++)
                     ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 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 376 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 376 KB Output is correct
11 Correct 2 ms 376 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 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 252 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 252 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 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 376 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 376 KB Output is correct
11 Correct 2 ms 376 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 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 252 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 252 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 376 KB Output is correct
26 Correct 2 ms 256 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 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 376 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 376 KB Output is correct
11 Correct 2 ms 376 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 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 252 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 252 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 376 KB Output is correct
26 Correct 2 ms 256 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 6 ms 520 KB Output is correct
29 Correct 2 ms 256 KB Output is correct
30 Correct 2 ms 360 KB Output is correct
31 Correct 2 ms 256 KB Output is correct
32 Correct 3 ms 376 KB Output is correct
33 Correct 4 ms 504 KB Output is correct
34 Correct 6 ms 504 KB Output is correct
35 Correct 5 ms 504 KB Output is correct
36 Correct 4 ms 376 KB Output is correct
37 Correct 3 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 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 376 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 376 KB Output is correct
11 Correct 2 ms 376 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 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 252 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 252 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 376 KB Output is correct
26 Correct 2 ms 256 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 6 ms 520 KB Output is correct
29 Correct 2 ms 256 KB Output is correct
30 Correct 2 ms 360 KB Output is correct
31 Correct 2 ms 256 KB Output is correct
32 Correct 3 ms 376 KB Output is correct
33 Correct 4 ms 504 KB Output is correct
34 Correct 6 ms 504 KB Output is correct
35 Correct 5 ms 504 KB Output is correct
36 Correct 4 ms 376 KB Output is correct
37 Correct 3 ms 376 KB Output is correct
38 Incorrect 105 ms 2540 KB on inputs (58, 84), (89, 65), expected 1, but computed 0
39 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 376 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
6 Correct 2 ms 380 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 256 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 376 KB Output is correct
12 Correct 2 ms 376 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 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 256 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 21 ms 884 KB Output is correct
4 Correct 27 ms 1368 KB Output is correct
5 Correct 23 ms 888 KB Output is correct
6 Correct 19 ms 504 KB Output is correct
7 Correct 17 ms 376 KB Output is correct
8 Correct 51 ms 1244 KB Output is correct
9 Incorrect 70 ms 2436 KB on inputs (0, 0), (43, 2), expected 1, but computed 0
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 289 ms 1520 KB on inputs (80, 199), (81, 199), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 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 376 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 376 KB Output is correct
11 Correct 2 ms 376 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 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 252 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 252 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 376 KB Output is correct
26 Correct 2 ms 256 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 6 ms 520 KB Output is correct
29 Correct 2 ms 256 KB Output is correct
30 Correct 2 ms 360 KB Output is correct
31 Correct 2 ms 256 KB Output is correct
32 Correct 3 ms 376 KB Output is correct
33 Correct 4 ms 504 KB Output is correct
34 Correct 6 ms 504 KB Output is correct
35 Correct 5 ms 504 KB Output is correct
36 Correct 4 ms 376 KB Output is correct
37 Correct 3 ms 376 KB Output is correct
38 Incorrect 105 ms 2540 KB on inputs (58, 84), (89, 65), expected 1, but computed 0
39 Halted 0 ms 0 KB -