I tried many different unsuccessful ways, the last of which I am describing below-
#include<iostream>
#include<fstream>
//functions here
using namespace std;
int main(){
int n;
long long A[300001];
ifstream myfile("sort.in");
myfile>>n;
for(int i=0;i<n;++i){
myfile>>A[i];
}
cout<<A[0];
myfile.close();
return 0;
}
This doesn't work.
Whereas, the below one works-
#include<iostream>
#include<fstream>
//functions here
using namespace std;
int main(){
int n;
int A[300001];
ifstream myfile("sort.in");
myfile>>n;
for(int i=0;i<n;++i){
myfile>>A[i];
}
cout<<A[0];
myfile.close();
return 0;
}
What is the problem?
The only difference is use of int instead of long long. How does that make such a big difference? By the way, by not working I mean that it is not producing any output on the screen.