Submission #1187833

#TimeUsernameProblemLanguageResultExecution timeMemory
1187833ziyad_alharbitimeismoney (balkan11_timeismoney)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define lcm(a,b) a*b/__gcd(a,b)
#define cc main
#define Stalin ios_base::sync_with_stdio(0);cin.tie(0);
#define hitler cout
#define mao_zedong cin
int rt[205];
int r(int x)
{
    if(rt[x]==x)return x;
    return rt[x]=r(rt[x]);
}
bool cn(int x,int y)
{
    if(r(x)==r(y))return 0;
    rt[rt[y]]=rt[x];
    return 1;
}
signed cc()
{
    stalin
    int n,m;
    mao_zedong>>n>>m;
    for(int x=0;x<n;x++)rt[x]=x;
    array<int,5>a[m];
    for(int x=0;x<m;x++)mao_zedong>>a[x][3]>>a[x][4]>>a[x][1]>>a[x][2],a[x][0]=max(a[x][1],a[x][2]);
    sort(a,a+m);
    int tm=0,mn=0,cnt=0;
    vector<array<int,2>>ans;
    for(int x=0;x<m&&cnt!=n-1;x++)
    {
        if(cn(a[x][3],a[x][4]))
        {
            ans.push_back({a[x][3],a[x][4]});
            tm+=a[x][1];
            mn+=a[x][2];
            cnt++;
        }
    }
    hitler<<tm<<' '<<mn<<'\n';
    for(auto [x,y]:ans)hitler<<x<<' '<<y<<'\n';
    return 0;
}

Compilation message (stderr)

timeismoney.cpp: In function 'int main()':
timeismoney.cpp:23:5: error: 'stalin' was not declared in this scope; did you mean 'Stalin'?
   23 |     stalin
      |     ^~~~~~
      |     Stalin
timeismoney.cpp:25:17: error: 'n' was not declared in this scope; did you mean 'yn'?
   25 |     mao_zedong>>n>>m;
      |                 ^
      |                 yn
timeismoney.cpp:25:20: error: 'm' was not declared in this scope; did you mean 'tm'?
   25 |     mao_zedong>>n>>m;
      |                    ^
      |                    tm
timeismoney.cpp:28:37: error: 'a' was not declared in this scope
   28 |     for(int x=0;x<m;x++)mao_zedong>>a[x][3]>>a[x][4]>>a[x][1]>>a[x][2],a[x][0]=max(a[x][1],a[x][2]);
      |                                     ^
timeismoney.cpp:29:10: error: 'a' was not declared in this scope
   29 |     sort(a,a+m);
      |          ^
timeismoney.cpp:36:26: error: no matching function for call to 'std::vector<std::array<long long int, 2> >::push_back(<brace-enclosed initializer list>)'
   36 |             ans.push_back({a[x][3],a[x][4]});
      |             ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/vector:67,
                 from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from timeismoney.cpp:1:
/usr/include/c++/11/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::array<long long int, 2>; _Alloc = std::allocator<std::array<long long int, 2> >; std::vector<_Tp, _Alloc>::value_type = std::array<long long int, 2>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::array<long long int, 2>&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::array<long long int, 2>; _Alloc = std::allocator<std::array<long long int, 2> >; std::vector<_Tp, _Alloc>::value_type = std::array<long long int, 2>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::array<long long int, 2> >::value_type&&' {aka 'std::array<long long int, 2>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~