제출 #146519

#제출 시각아이디문제언어결과실행 시간메모리
146519jwvg0425Safety (NOI18_safety)C++17
5 / 100
54 ms1144 KiB
#include <stdio.h> #include <vector> #include <queue> #include <algorithm> #include <iostream> #include <string> #include <bitset> #include <map> #include <set> #include <tuple> #include <string.h> #include <math.h> #include <random> #include <functional> #include <assert.h> #include <math.h> #define all(x) (x).begin(), (x).end() #define xx first #define yy second #define MOD 998244353 #define BUCKET 700 using namespace std; using i64 = long long int; using ii = pair<int, int>; using ii64 = pair<i64, i64>; int main() { int n, h; scanf("%d %d", &n, &h); vector<int> s(n); for (int i = 0; i < n; i++) scanf("%d", &s[i]); sort(all(s)); int m = s[n / 2]; i64 ans = 0; for (int i = 0; i < n; i++) ans += abs(m - s[i]); printf("%lld\n", ans); return 0; }

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

safety.cpp: In function 'int main()':
safety.cpp:32:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &h);
  ~~~~~^~~~~~~~~~~~~~~~~
safety.cpp:37:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &s[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...
#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...