Submission #691713

#TimeUsernameProblemLanguageResultExecution timeMemory
691713NemanjaSo2005Aliens (IOI16_aliens)C++14
Compilation error
0 ms0 KiB
#include "aliens.h"
#include<bits/stdc++.h>
#define ll long long
int N,M,K;
struct tacka{
    int x,y;/// X i Y su kao u matematici
} tniz[100005],niz[100005],tpp;
stack<tacka> S;
bool pox(tacka a,tacka b){
    if(a.x<b.x)
        return true;
    if(a.x>b.x)
        return false;
    return a.y>b.y;
}
long long take_photos(int n, int m, int k, std::vector<int> r, std::vector<int> c) {
    N=n;
    M=m;
    K=k;
    for(int i=1;i<=N;i++){
        tniz[i].x=c[i-1];
        tniz[i].y=r[i-1];
    }
    for(int i=1;i<=N;i++)
        if(tniz[i].x<tniz[i].y)
            swap(tniz[i].x,tniz[i].y);
    sort(tniz+1,tniz+1+N,pox);
    tpp.x=-1;
    tpp.y=1e9;
    for(int i=1;i<=N;i++){
        if(S.top().x)
    }
    return 0;
}

#include "aliens.h"
#include <cstdio>
#include <cassert>
int main() {
    int n, m, k;
    assert(3 == scanf("%d %d %d", &n, &m, &k));
    std::vector<int> r(n), c(n);
    for (int i = 0; i < n; i++) {
        assert(2 == scanf("%d %d", &r[i], &c[i]));
    }
    long long ans = take_photos(n, m, k, r, c);
    
    
    printf("%lld\n", ans);
    return 0;
}

Compilation message (stderr)

aliens.cpp:8:1: error: 'stack' does not name a type
    8 | stack<tacka> S;
      | ^~~~~
aliens.cpp: In function 'long long int take_photos(int, int, int, std::vector<int>, std::vector<int>)':
aliens.cpp:26:13: error: 'swap' was not declared in this scope
   26 |             swap(tniz[i].x,tniz[i].y);
      |             ^~~~
aliens.cpp:26:13: note: suggested alternatives:
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from aliens.cpp:2:
/usr/include/c++/10/bits/regex.h:2141:5: note:   'std::__cxx11::swap'
 2141 |     swap(match_results<_Bi_iter, _Alloc>& __lhs,
      |     ^~~~
In file included from /usr/include/c++/10/bits/stl_pair.h:59,
                 from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/vector:60,
                 from aliens.h:3,
                 from aliens.cpp:1:
/usr/include/c++/10/bits/move.h:189:5: note:   'std::swap'
  189 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
In file included from /usr/include/c++/10/exception:147,
                 from /usr/include/c++/10/new:41,
                 from /usr/include/c++/10/ext/new_allocator.h:33,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/c++allocator.h:33,
                 from /usr/include/c++/10/bits/allocator.h:46,
                 from /usr/include/c++/10/vector:64,
                 from aliens.h:3,
                 from aliens.cpp:1:
/usr/include/c++/10/bits/exception_ptr.h:169:5: note:   'std::__exception_ptr::swap'
  169 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |     ^~~~
aliens.cpp:27:5: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   27 |     sort(tniz+1,tniz+1+N,pox);
      |     ^~~~
      |     std::sort
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from aliens.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:4880:5: note: 'std::sort' declared here
 4880 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
aliens.cpp:31:12: error: 'S' was not declared in this scope
   31 |         if(S.top().x)
      |            ^
aliens.cpp:32:5: error: expected primary-expression before '}' token
   32 |     }
      |     ^