답안 #545392

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
545392 2022-04-04T12:26:03 Z Trisanu_Das Labels (NOI20_labels) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namepsace std;
 
int main(){
  int n; cin >> n;
  int d[n - 1]; for(int i = 0; i < n - 1; i++) cin >> d[i];
  if(d[0] == 1) cout << 1 << ' ' << 2 << '\n';
  else if(d[0] == -1) cout << 2 << ' ' << 1 << '\n';
  else cout << -1 << '\n';
}

Compilation message

Labels.cpp:2:7: error: expected nested-name-specifier before 'namepsace'
    2 | using namepsace std;
      |       ^~~~~~~~~
Labels.cpp: In function 'int main()':
Labels.cpp:5:10: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |   int n; cin >> n;
      |          ^~~
      |          std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75,
                 from Labels.cpp:1:
/usr/include/c++/10/iostream:60:18: note: 'std::cin' declared here
   60 |   extern istream cin;  /// Linked to standard input
      |                  ^~~
Labels.cpp:7:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    7 |   if(d[0] == 1) cout << 1 << ' ' << 2 << '\n';
      |                 ^~~~
      |                 std::cout
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75,
                 from Labels.cpp:1:
/usr/include/c++/10/iostream:61:18: note: 'std::cout' declared here
   61 |   extern ostream cout;  /// Linked to standard output
      |                  ^~~~
Labels.cpp:8:23: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    8 |   else if(d[0] == -1) cout << 2 << ' ' << 1 << '\n';
      |                       ^~~~
      |                       std::cout
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75,
                 from Labels.cpp:1:
/usr/include/c++/10/iostream:61:18: note: 'std::cout' declared here
   61 |   extern ostream cout;  /// Linked to standard output
      |                  ^~~~
Labels.cpp:9:8: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    9 |   else cout << -1 << '\n';
      |        ^~~~
      |        std::cout
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75,
                 from Labels.cpp:1:
/usr/include/c++/10/iostream:61:18: note: 'std::cout' declared here
   61 |   extern ostream cout;  /// Linked to standard output
      |                  ^~~~