Compile Error
foo.cc:1:1: error: 'include' does not name a type 1 | include<bits/stdc++.h> | ^~~~~~~ foo.cc: In function 'int main()': foo.cc:6:9: error: 'cin' was not declared in this scope 6 | cin >> n; | ^~~ foo.cc:29:17: error: 'cout' was not declared in this scope 29 | cout << min << " " << index; | ^~~~ foo.cc:31:31: error: invalid types 'int[int]' for array subscript 31 | arr[index] = q[k]; | ^ foo.cc:32:25: error: 'endl' was not declared in this scope 32 | cout << endl; | ^~~~ foo.cc:34:2: error: expected '}' at end of input 34 | } | ^ foo.cc:3:11: note: to match this '{' 3 | int main(){ | ^
Code
include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int arr[n];
for(int i=0; i<n; i++){
cin >> arr[i];
}
int q;
cin >> q;
int qrr[q];
for(int i =0 ; i<q; i++){
cin >> qrr[i];
}
int k = 0;
while(k<q){
int min = arr[0];
int index = 0;
for(int i=0; i<n ; i++){
if(arr[i]<min){
min = arr[i];
index = i;
}
}
cout << min << " " << index;
arr[index] = q[k];
cout << endl;
k++;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1086 KuZ the Position
- Contest
- Bangladesh 2.0
- Language
- C++11 (G++ 13.2.0)
- Submit At
- 2024-08-16 17:40:45
- Judged At
- 2024-10-03 13:21:11
- Judged By
- Score
- 0
- Total Time
- 0ms
- Peak Memory
- 0 Bytes