Submission #1157763

#TimeUsernameProblemLanguageResultExecution timeMemory
1157763yf_yusufRoad Construction (JOI21_road_construction)C++20
Compilation error
0 ms0 KiB
//```// YF YUSUF #define Free_open(File) freopen((File".in"),"r",stdin);freopen((File".out"),"w",stdout); #define YF ios_base::sync_with_stdio(0);cout.setf(ios::fixed); #define YUSUF cout.precision(0);cout.tie(0);cin.tie(0); #include <bits/stdc++.h> using namespace std; #ifdef YF_CHECK bool Output=1; #include "g/debug.h" //#include "g/bigint.h" //#include "g/text.h" #else bool Output=0; #define deb(x...) 42 #endif using ll = long long; using ld = long double; using vll = vector <ll>; using mll = map <ll,ll>; using pll = pair <ll,ll>; using vpll= vector <pll>; template<class T>T MIN(T&a,T b){a=min(a,b);return a;} template<class T>T MAX(T&a,T b){a=max(a,b);return a;} #define revers(a) reverse(all(a)) #define all(a) a.begin(),a.end() #define sortt(a) sort(all(a)) #define sgr v+v+1,tm+1,tr #define sgl v+v,tl,tm #define pb push_back #define ins insert #define S second #define F first #define int ll ll BP(ll a,ll b,ll mod=1e9+7){ if(b==0)return 1; ll q=BP(a,b/2,mod); return ((q*q)%mod*(b%2?a:1ll))%mod; } ll dup(ll a,ll b){return (a+b-1)/b;} ll f(ll x){return x*(x+1)/2;} const int mod=998244353; const int INF=1e18+7; const int inf=1e9+7; const int N =1e6+7; void YF_MAIN(){ cin>>n,k; cin>>n>>k; set<pair<ll,pll>st; pll a[n+1]; for(int i=1;i<=n;i++){ cin>>a[i].F>>a[i].S; for(int j=1;j<i;j++){ st.ins({abs(a[i].F-a[j].F)+abs(a[i].S-a[j].S),{i,j}}); } } while(k--){ auto now=*st.begin(); cout<<now.F<<"\n"; st.erase(now); } } bool TECT=0; bool CASE=0; bool OUTP=1; //ll FACT[1],inv[1],FMOD=1e9+7; //ll PER(ll n,ll k){return FACT[n] *inv[n-k]%FMOD;} //ll CNK(ll n,ll k){return PER(n,k)*inv[k ]%FMOD;} //ll lg[1]; void BEFORE(){ // return; // FACT[0]=inv[0]=1; // for(int i=2;i<N;i++){ // lg[i]=lg[i/2]+1; // } // for(int i=1;i<=1e6;i++){ // FACT[i]=FACT[i-1]*i%FMOD; // inv[i]=BP(FACT[i],FMOD-2,FMOD); // } } signed main(){ if(OUTP){YF YUSUF} // Free_open("TEST"); cout<<(Output ? "\nYF_OUTPUT:\n\n" : ""); int TEST=1; if(TECT) cin>>TEST; BEFORE(); for(int T=1;T<=TEST;T++){ if(CASE) cout<<"Case "<<T<<": "; YF_MAIN(); cout<<(T==TEST ? "" : "\n"); } return 0; } //```

Compilation message (stderr)

road_construction.cpp: In function 'void YF_MAIN()':
road_construction.cpp:46:14: error: 'n' was not declared in this scope
   46 |         cin>>n,k;
      |              ^
road_construction.cpp:46:16: error: 'k' was not declared in this scope
   46 |         cin>>n,k;
      |                ^
road_construction.cpp:48:25: error: template argument 1 is invalid
   48 |         set<pair<ll,pll>st;
      |                         ^~
road_construction.cpp:48:25: error: template argument 2 is invalid
road_construction.cpp:48:25: error: template argument 3 is invalid
road_construction.cpp:51:22: error: 'a' was not declared in this scope
   51 |                 cin>>a[i].F>>a[i].S;
      |                      ^
road_construction.cpp:53:25: error: 'st' was not declared in this scope; did you mean 'std'?
   53 |                         st.ins({abs(a[i].F-a[j].F)+abs(a[i].S-a[j].S),{i,j}});
      |                         ^~
      |                         std
road_construction.cpp:57:27: error: 'st' was not declared in this scope; did you mean 'std'?
   57 |                 auto now=*st.begin();
      |                           ^~
      |                           std