제출 #1358109

#제출 시각아이디문제언어결과실행 시간메모리
1358109kmath628정전 (OJUZ10_blackout)C++20
30 / 100
16 ms996 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int n,l,i;
    ll s=0;
    scanf("%d %d",&n,&l);
    vector<int> a(n);
    for(i=0;i<n;i++) scanf("%d",&a[i]);
    sort(a.begin(),a.end());
    for(i=0;i<n-1;i++) s+=max(a[i]-a[i+1]+2*l,0);
    printf("%lld\n",s);
}

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

blackout.cpp: In function 'int main()':
blackout.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     scanf("%d %d",&n,&l);
      |     ~~~~~^~~~~~~~~~~~~~~
blackout.cpp:9:27: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     for(i=0;i<n;i++) scanf("%d",&a[i]);
      |                      ~~~~~^~~~~~~~~~~~
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…