제출 #706597

#제출 시각아이디문제언어결과실행 시간메모리
706597YugiHackerUnija (COCI17_unija)C++14
100 / 100
302 ms23256 KiB
#include<bits/stdc++.h> #define el cout<<"\n" #define f0(i,n) for(int i=0;i<n;++i) #define f1(i,n) for(int i=1;i<=n;++i) #define maxn 1000006 #define pii pair<int, int> #define fi first #define se second using namespace std; int n; pair<int, int> a[maxn]; main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin >> n; f1 (i, n) cin >> a[i].fi >> a[i].se; sort(a+1, a+n+1); long long ans = 0; int maSe = 0; for (int i=n; i; i--) { maSe = max(maSe, a[i].se); ans += 1ll*(a[i].fi-a[i-1].fi) * maSe; } cout << ans; }

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

unija.cpp:12:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   12 | main()
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...