답안 #472017

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
472017 2021-09-12T11:10:57 Z hjc4vr Baloni (COCI15_baloni) C++14
컴파일 오류
0 ms 0 KB
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <sstream>
#include <numeric>
#include <tuple>
#include <algorithm>
#include <unordered_map>
#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();
}

Compilation message

baloni.cpp: In function 'void solve()':
baloni.cpp:24:11: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   24 |     int n;cin>>n;
      |           ^~~
      |           std::cin
In file included 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:25:5: error: 'unordered_map' was not declared in this scope; did you mean 'std::unordered_map'?
   25 |     unordered_map<int,bool> mp;
      |     ^~~~~~~~~~~~~
      |     std::unordered_map
In file included from /usr/include/c++/10/unordered_map:47,
                 from baloni.cpp:12:
/usr/include/c++/10/bits/unordered_map.h:102:11: note: 'std::unordered_map' declared here
  102 |     class unordered_map
      |           ^~~~~~~~~~~~~
baloni.cpp:13:13: error: expected primary-expression before 'long'
   13 | #define int long long
      |             ^~~~
baloni.cpp:25:19: note: in expansion of macro 'int'
   25 |     unordered_map<int,bool> mp;
      |                   ^~~
baloni.cpp:28:9: error: 'mp' was not declared in this scope
   28 |         mp[a+i] = true;
      |         ^~
baloni.cpp:30:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   30 |     cout << mp.size();
      |     ^~~~
      |     std::cout
In file included 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:30:13: error: 'mp' was not declared in this scope
   30 |     cout << mp.size();
      |             ^~
baloni.cpp: In function 'int32_t main()':
baloni.cpp:35:5: error: 'ios_base' has not been declared
   35 |     ios_base::sync_with_stdio(0);cin.tie(0);
      |     ^~~~~~~~
baloni.cpp:35:34: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   35 |     ios_base::sync_with_stdio(0);cin.tie(0);
      |                                  ^~~
      |                                  std::cin
In file included from baloni.cpp:1:
/usr/include/c++/10/iostream:60:18: note: 'std::cin' declared here
   60 |   extern istream cin;  /// Linked to standard input
      |                  ^~~