답안 #472018

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
472018 2021-09-12T11:12:54 Z hjc4vr Baloni (COCI15_baloni) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define int long long
#define pp pair <bool,int>
#define ppi pair <int,int>
#define tp tuple <int,int,int,bool>
#define c1(x) cin >> x
#define c2(x,y) cin >> x >> y
#define c3(x,y,z) cin >> x >> y >> z
#define c4(x,y,z,f) cin>> x >> y >> z >> f
#define mp(a,b) make_pair(a,b)

void solve(){
    int n;cin>>n;
    unordered_map<int,bool> mp;
    for (int i=0;i<n;++i){
        int a;cin>>a;
        mp[a+i] = true;
    }
    cout << mp.size();
}


int32_t main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    solve();
}
//  1 6 9 3 4 10 3 9

Compilation message

baloni.cpp: In function 'void solve()':
baloni.cpp:13:11: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   13 |     int n;cin>>n;
      |           ^~~
      |           std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75,
                 from baloni.cpp:1:
/usr/include/c++/10/iostream:60:18: note: 'std::cin' declared here
   60 |   extern istream cin;  /// Linked to standard input
      |                  ^~~
baloni.cpp:14:5: error: 'unordered_map' was not declared in this scope
   14 |     unordered_map<int,bool> mp;
      |     ^~~~~~~~~~~~~
baloni.cpp:14:5: note: suggested alternatives:
In file included from /usr/include/c++/10/unordered_map:47,
                 from /usr/include/c++/10/functional:61,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from baloni.cpp:1:
/usr/include/c++/10/bits/unordered_map.h:102:11: note:   'std::unordered_map'
  102 |     class unordered_map
      |           ^~~~~~~~~~~~~
In file included from /usr/include/c++/10/functional:61,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from baloni.cpp:1:
/usr/include/c++/10/unordered_map:64:13: note:   'std::pmr::unordered_map'
   64 |       using unordered_map
      |             ^~~~~~~~~~~~~
baloni.cpp:2:13: error: expected primary-expression before 'long'
    2 | #define int long long
      |             ^~~~
baloni.cpp:14:19: note: in expansion of macro 'int'
   14 |     unordered_map<int,bool> mp;
      |                   ^~~
baloni.cpp:17:9: error: 'mp' was not declared in this scope
   17 |         mp[a+i] = true;
      |         ^~
baloni.cpp:19:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   19 |     cout << mp.size();
      |     ^~~~
      |     std::cout
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75,
                 from baloni.cpp:1:
/usr/include/c++/10/iostream:61:18: note: 'std::cout' declared here
   61 |   extern ostream cout;  /// Linked to standard output
      |                  ^~~~
baloni.cpp:19:13: error: 'mp' was not declared in this scope
   19 |     cout << mp.size();
      |             ^~
baloni.cpp: In function 'int32_t main()':
baloni.cpp:24:5: error: 'ios_base' has not been declared
   24 |     ios_base::sync_with_stdio(0);cin.tie(0);
      |     ^~~~~~~~
baloni.cpp:24:34: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   24 |     ios_base::sync_with_stdio(0);cin.tie(0);
      |                                  ^~~
      |                                  std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75,
                 from baloni.cpp:1:
/usr/include/c++/10/iostream:60:18: note: 'std::cin' declared here
   60 |   extern istream cin;  /// Linked to standard input
      |                  ^~~