Submission #788992

# Submission time Handle Problem Language Result Execution time Memory
788992 2023-07-20T20:02:00 Z VMaksimoski008 Autići (COCI22_autici) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  long long arr[n];
  long long ans = 0;
  
  for(int i=0; i<n; i++) cin >> arr[i];
  sort(arr, arr + n);
  
  for(int i=1; i<n; i++)
    ans += (arr[i] - arr[0]);
  
  cout << ans << '\n';
  return 0;
} 

Compilation message

Main.cpp:5:2: error: extended character   is not valid in an identifier
    5 |   int n;
      |  ^
Main.cpp:6:2: error: extended character   is not valid in an identifier
    6 |   cin >> n;
      |  ^
Main.cpp:7:2: error: extended character   is not valid in an identifier
    7 |   long long arr[n];
      |  ^
Main.cpp:8:2: error: extended character   is not valid in an identifier
    8 |   long long ans = 0;
      |  ^
Main.cpp:10:2: error: extended character   is not valid in an identifier
   10 |   for(int i=0; i<n; i++) cin >> arr[i];
      |  ^
Main.cpp:11:2: error: extended character   is not valid in an identifier
   11 |   sort(arr, arr + n);
      |  ^
Main.cpp:13:2: error: extended character   is not valid in an identifier
   13 |   for(int i=1; i<n; i++)
      |  ^
Main.cpp:14:2: error: extended character   is not valid in an identifier
   14 |     ans += (arr[i] - arr[0]);
      |  ^
Main.cpp:14:5: error: extended character   is not valid in an identifier
   14 |     ans += (arr[i] - arr[0]);
      |    ^
Main.cpp:16:2: error: extended character   is not valid in an identifier
   16 |   cout << ans << '\n';
      |  ^
Main.cpp:17:2: error: extended character   is not valid in an identifier
   17 |   return 0;
      |  ^
Main.cpp: In function 'int main()':
Main.cpp:5:2: error: '\U000000a0int' was not declared in this scope
    5 |   int n;
      |  ^~~~
Main.cpp:6:2: error: '\U000000a0cin' was not declared in this scope
    6 |   cin >> n;
      |  ^~~~
Main.cpp:6:11: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |   cin >> n;
      |          ^
      |          yn
Main.cpp:7:2: error: '\U000000a0long' was not declared in this scope; did you mean 'ulong'?
    7 |   long long arr[n];
      |  ^~~~~
      |  ulong
Main.cpp:8:8: error: expected ';' before 'long'
    8 |   long long ans = 0;
      |       ^~~~~
      |       ;
Main.cpp:10:8: error: expected primary-expression before 'int'
   10 |   for(int i=0; i<n; i++) cin >> arr[i];
      |       ^~~
Main.cpp:10:17: error: 'i' was not declared in this scope
   10 |   for(int i=0; i<n; i++) cin >> arr[i];
      |                ^
Main.cpp:11:9: error: 'arr' was not declared in this scope
   11 |   sort(arr, arr + n);
      |        ^~~
Main.cpp:11:2: error: '\U000000a0sort' was not declared in this scope; did you mean 'qsort'?
   11 |   sort(arr, arr + n);
      |  ^~~~~
      |  qsort
Main.cpp:13:8: error: expected primary-expression before 'int'
   13 |   for(int i=1; i<n; i++)
      |       ^~~
Main.cpp:16:2: error: '\U000000a0cout' was not declared in this scope
   16 |   cout << ans << '\n';
      |  ^~~~~
Main.cpp:16:12: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |   cout << ans << '\n';
      |           ^~~
      |           abs
Main.cpp:17:2: error: '\U000000a0return' was not declared in this scope; did you mean 'sigreturn'?
   17 |   return 0;
      |  ^~~~~~~
      |  sigreturn