제출 #341130

#제출 시각아이디문제언어결과실행 시간메모리
341130beksultan04K개의 묶음 (IZhO14_blocks)C++14
0 / 100
1 ms492 KiB
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define pii pair<int,int>
#define OK puts("OK");
#define NO puts("NO");
#define YES puts("YES");
#define fr first
#define sc second
#define ret return
#define scanl(a) scanf("%lld",&a);
#define scanll(a,b) scanf("%lld %lld",&a, &b);
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c);
#define scan1(a) scanf("%d",&a);
#define scan2(a,b) scanf("%d %d",&a, &b);
#define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define all(s) s.begin(),s.end()
#define allr(s) s.rbegin(),s.rend()
#define pb push_back
#define sz(v) (int)v.size()
#define endi puts("");
#define eps 1e-12
const int N = 1e6+12,INF=1e9+7;

int q[N];
main(){
    int n,i,k;
    scan2(n,k)
    for (i=1;i<=n;++i){
        scan1(q[i])
    }
    sort(q+1,q+n+1);
    int sum=0;
    for (i=1;i<k;++i){
        sum += q[i];
    }
    cout <<sum+q[n];
}

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

blocks.cpp:26:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   26 | main(){
      |      ^
blocks.cpp: In function 'int main()':
blocks.cpp:15:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   15 | #define scan2(a,b) scanf("%d %d",&a, &b);
      |                    ~~~~~^~~~~~~~~~~~~~~~
blocks.cpp:28:5: note: in expansion of macro 'scan2'
   28 |     scan2(n,k)
      |     ^~~~~
blocks.cpp:14:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   14 | #define scan1(a) scanf("%d",&a);
      |                  ~~~~~^~~~~~~~~
blocks.cpp:30:9: note: in expansion of macro 'scan1'
   30 |         scan1(q[i])
      |         ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...