답안 #137100

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
137100 2019-07-27T05:23:21 Z KLPP Unija (COCI17_unija) C++14
100 / 100
430 ms 31096 KB
#include<bits/stdc++.h>

using namespace std;
typedef long long int lld;
typedef pair<lld,lld> pii;
#define rep(i,a,b) for(int i=a;i<b;i++)

int main(){
  int n;
  scanf("%d",&n);
  pii arr[n];
  rep(i,0,n){
    scanf("%lld %lld",&arr[i].first,&arr[i].second);
    arr[i].first/=2;
    arr[i].second/=2;
  }
  sort(arr,arr+n);
  reverse(arr,arr+n);
  lld max_second=0;
  lld ans=0;
  rep(i,0,n){
    ans+=arr[i].first*(max(max_second,arr[i].second)-max_second);
    max_second=max(max_second,arr[i].second);
  }
  printf("%lld\n",ans*4);
  return 0;
}

Compilation message

unija.cpp: In function 'int main()':
unija.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&n);
   ~~~~~^~~~~~~~~
unija.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld %lld",&arr[i].first,&arr[i].second);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 400 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 504 KB Output is correct
2 Correct 4 ms 504 KB Output is correct
3 Correct 4 ms 520 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 430 ms 17804 KB Output is correct
2 Correct 418 ms 31096 KB Output is correct
3 Correct 424 ms 30968 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 252 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 1016 KB Output is correct
2 Correct 13 ms 1016 KB Output is correct
3 Correct 13 ms 1016 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 2168 KB Output is correct
2 Correct 39 ms 2292 KB Output is correct
3 Correct 41 ms 2168 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 117 ms 5316 KB Output is correct
2 Correct 117 ms 5240 KB Output is correct
3 Correct 118 ms 5316 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 410 ms 17656 KB Output is correct
2 Correct 414 ms 31000 KB Output is correct
3 Correct 412 ms 31068 KB Output is correct