Submission #637328

#TimeUsernameProblemLanguageResultExecution timeMemory
637328boris_mihov전선 연결 (IOI17_wiring)C++17
Compilation error
0 ms0 KiB
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <set>

typedef long long llong;
const int MAXN = 1000 + 10;
const llong INF = 1e18;

int n, m;
int r[MAXN];
int b[MAXN];
int perm[MAXN];
int rndVal[MAXN];
std::set <int> cnt;

int main()
{
    srand(time(nullptr));
    int n = rand()%3+3;
    int m = rand()%3+3;
    std::iota(perm + 1, perm + 1 + n + m, 1);
    std::random_shuffle(perm + 1, perm + 1 + n + m);
    for (int i = 1 ; i <= n+m ; ++i)
    {
        do rndVal[i] = rand()%100 + 1;
        while (cnt.count(rndVal[i]));
        cnt.insert(rndVal[i]);
    }

    std::sort(rndVal + 1, rndVal + 1 + n + m);
    std::sort(perm + 1, perm + 1 + n);
    std::sort(perm + 1 + n, perm + 1 + n + m);
    std::cout << n << ' ' << m << '\n';
    for (int i = 1 ; i <= n ; ++i) std::cout << rndVal[perm[i]] << ' '; std::cout << '\n';
    for (int i = 1 ; i <= m ; ++i) std::cout << rndVal[perm[n + i]] << ' '; std::cout << '\n';
    return 0;
}

Compilation message (stderr)

wiring.cpp: In function 'int main()':
wiring.cpp:36:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   36 |     for (int i = 1 ; i <= n ; ++i) std::cout << rndVal[perm[i]] << ' '; std::cout << '\n';
      |     ^~~
wiring.cpp:36:73: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   36 |     for (int i = 1 ; i <= n ; ++i) std::cout << rndVal[perm[i]] << ' '; std::cout << '\n';
      |                                                                         ^~~
wiring.cpp:37:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   37 |     for (int i = 1 ; i <= m ; ++i) std::cout << rndVal[perm[n + i]] << ' '; std::cout << '\n';
      |     ^~~
wiring.cpp:37:77: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   37 |     for (int i = 1 ; i <= m ; ++i) std::cout << rndVal[perm[n + i]] << ' '; std::cout << '\n';
      |                                                                             ^~~
/usr/bin/ld: /tmp/ccrlSmkH.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc9IRpRF.o:wiring.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccrlSmkH.o: in function `main':
grader.cpp:(.text.startup+0x23a): undefined reference to `min_total_length(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status