If my code just simple like:
#include <bits/stdc++.h>
using namespace std;
int main(){
cout<<"hi";
return 0;
}
then it can write hi in my .out file. But if my code just become more complex like:
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<=b;++i)
using namespace std;
const int INF=1000000000;
struct Edge{
int u,v,w;
void inp(){
cin>>u>>v>>w;
}
void out(){
cout<<u<<' '<<v<<' '<<w<<'\n';
}
};
int n,m;
Edge ed[5005];
int D[2505];
void bellman(){
FOR(i,0,n-1) D[i]=-INF;
D[s]=0;
FOR(t,1,n-1) FOR(i,1,m){
int u=ed[i].u,v=ed[i].v,w=ed[i].w;
if (D[u]!=-INF&&D[v]<D[u]+w) D[v]=D[u]+w;
}
FOR(t,1,n) FOR(i,1,m){
int u=ed[i].u,v=ed[i].v,w=ed[i].w;
if (D[u]!=-INF&&D[v]<D[u]+w) D[v]=INF;
}
}
int main(){
cin>>n>>m;
FOR(i,1,m) ed[i].inp();
FOR(i,1,m) ed[i].out();
bellman();
cout<<D[n];
return 0;
}
it just show
[Finished in 2.9s]
without write any output in my file.
this is my sublime-build file:
{
"cmd": ["g++.exe", "-std=c++17", "${file}",
"-o", "${file_base_name}.exe",
"&&", "${file_base_name}.exe<input.inp>output.out"],
"shell":true,
"working_dir":"$file_path",
"selector":"source.cpp"
}
I tried to reset, and I have no idea about this thing.