CSES - NOI 2024 - Results
Submission details
Task:Anime Shops
Sender:Aino Aulanko
Submission time:2024-03-06 16:12:57 +0200
Language:C++ (C++11)
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:6:20: error: expected initializer before '.' token
    6 |     long long int n. m, k, x, a, b;
      |                    ^
input/code.cpp:7:12: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 |     cin >> n >> m >> k;
      |            ^
      |            yn
input/code.cpp:7:17: error: 'm' was not declared in this scope; did you mean 'tm'?
    7 |     cin >> n >> m >> k;
      |                 ^
      |                 tm
input/code.cpp:7:22: error: 'k' was not declared in this scope
    7 |     cin >> n >> m >> k;
      |                      ^
input/code.cpp:10:16: error: 'x' was not declared in this scope
   10 |         cin >> x;
      |                ^
input/code.cpp:11:9: error: 't' was not declared in this scope
   11 |         t[i]=x;
      |         ^
input/code.cpp:13:5: error: 'a' was not declared in this scope
   13 |     a=0;
      |     ^
input/code.cpp:14:5: error: 'b' was not declared in t...

Code

#include <bits/stdc++.h>
using namespace std;
int main(){
long long int n. m, k, x, a, b;
cin >> n >> m >> k;
long long int t[k]={0};
for (long long int i=0; i<k; i++){
cin >> x;
t[i]=x;
}
a=0;
b=1;
for (long long int i=0; i<n; i++){
if (t[b]==i){
b++;
cout << min(t[b]-i, i-t[a]) << " ";
a++;
}
else {
cout << min(t[b]-i, i-t[a]) << " ";
}
}
}