제출 #1187852

#제출 시각아이디문제언어결과실행 시간메모리
1187852ziyad_alharbi시간이 돈 (balkan11_timeismoney)C++20
50 / 100
4 ms840 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define lcm(a,b) a*b/__gcd(a,b) #define cc main #define Stalin ios_base::sync_with_stdio(0);cin.tie(0); #define Hitler cout #define Mao_Zedong cin int rt[205],n,m; int r(int x) { if(rt[x]==x)return x; return rt[x]=r(rt[x]); } bool cn(int x,int y) { if(r(x)==r(y))return 0; rt[rt[y]]=rt[x]; return 1; } void in() { for(int x=0;x<=n;x++)rt[x]=x; } cc() { Stalin Mao_Zedong>>n>>m; array<int,5>a[m]; for(int x=0;x<m;x++)Mao_Zedong>>a[x][3]>>a[x][4]>>a[x][1]>>a[x][2],a[x][0]=a[x][2]; sort(a,a+m); in(); int tm1=0,mn1=0,cnt=0; vector<array<int,2>>ans1; for(int x=0;x<m&&cnt!=n-1;x++) { if(cn(a[x][3],a[x][4])) { ans1.push_back({a[x][3],a[x][4]}); tm1+=a[x][1]; mn1+=a[x][2]; cnt++; } } for(int x=0;x<m;x++)a[x][0]=a[x][1]; sort(a,a+m); in(); int tm2=0,mn2=0; cnt=0; vector<array<int,2>>ans2; for(int x=0;x<m&&cnt!=n-1;x++) { if(cn(a[x][3],a[x][4])) { ans2.push_back({a[x][3],a[x][4]}); tm2+=a[x][1]; mn2+=a[x][2]; cnt++; } } if(tm2*mn2<=tm1*mn1) { Hitler<<tm2<<' '<<mn2<<'\n'; for(auto [x,y]:ans2)Hitler<<x<<' '<<y<<'\n'; } else { Hitler<<tm1<<' '<<mn1<<'\n'; for(auto [x,y]:ans1)Hitler<<x<<' '<<y<<'\n'; } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

timeismoney.cpp:5:12: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | #define cc main
      |            ^~~~
timeismoney.cpp:25:1: note: in expansion of macro 'cc'
   25 | cc()
      | ^~
#Verdict Execution timeMemoryGrader output
Fetching results...