답안 #167758

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
167758 2019-12-10T04:00:39 Z davitmarg Vision Program (IOI19_vision) C++17
44 / 100
50 ms 1912 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 <= 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 <= 10000 - 2; c++)
                     ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 420 KB Output is correct
2 Correct 2 ms 256 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 252 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 256 KB Output is correct
12 Correct 2 ms 424 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 256 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 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 420 KB Output is correct
2 Correct 2 ms 256 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 252 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 256 KB Output is correct
12 Correct 2 ms 424 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 256 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 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 256 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 296 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 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 420 KB Output is correct
2 Correct 2 ms 256 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 252 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 256 KB Output is correct
12 Correct 2 ms 424 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 256 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 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 256 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 296 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 256 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 380 KB Output is correct
31 Correct 2 ms 256 KB Output is correct
32 Correct 3 ms 376 KB Output is correct
33 Correct 5 ms 476 KB Output is correct
34 Correct 8 ms 760 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 356 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 420 KB Output is correct
2 Correct 2 ms 256 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 252 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 256 KB Output is correct
12 Correct 2 ms 424 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 256 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 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 256 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 296 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 256 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 380 KB Output is correct
31 Correct 2 ms 256 KB Output is correct
32 Correct 3 ms 376 KB Output is correct
33 Correct 5 ms 476 KB Output is correct
34 Correct 8 ms 760 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 356 KB Output is correct
38 Incorrect 2 ms 508 KB WA in grader: Instruction with no inputs
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 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 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 3 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 396 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 256 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 256 KB Output is correct
3 Correct 19 ms 852 KB Output is correct
4 Correct 33 ms 1908 KB Output is correct
5 Correct 27 ms 1396 KB Output is correct
6 Correct 19 ms 792 KB Output is correct
7 Correct 14 ms 416 KB Output is correct
8 Correct 22 ms 760 KB Output is correct
9 Correct 37 ms 1912 KB Output is correct
10 Correct 31 ms 1400 KB Output is correct
11 Correct 43 ms 1016 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 380 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Incorrect 3 ms 760 KB WA in grader: Instruction with no inputs
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 884 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 420 KB Output is correct
2 Correct 2 ms 256 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 252 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 256 KB Output is correct
12 Correct 2 ms 424 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 256 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 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 256 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 296 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 256 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 380 KB Output is correct
31 Correct 2 ms 256 KB Output is correct
32 Correct 3 ms 376 KB Output is correct
33 Correct 5 ms 476 KB Output is correct
34 Correct 8 ms 760 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 356 KB Output is correct
38 Incorrect 2 ms 508 KB WA in grader: Instruction with no inputs
39 Halted 0 ms 0 KB -