제출 #1004477

#제출 시각아이디문제언어결과실행 시간메모리
1004477victor_gaoRoom Temperature (JOI24_ho_t1)C++17
100 / 100
81 ms9164 KiB
//#pragma GCC optimize("Ofast,unroll-loops,O3") //#pragma GCC target("avx,avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,fma,tune=native") #include <bits/stdc++.h> #define int long long #define pii pair<int, int> #define x first #define y second using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); signed main(){ ios::sync_with_stdio(0); cin.tie(0); int n, k; vector<int> vt; cin >> n >> k; for (int i = 1; i <= n; i++){ int t; cin >> t; vt.push_back(t % k); } sort(vt.begin(), vt.end()); int ans = (vt.back() - vt[0] + 1) / 2; for (int i = 1; i < vt.size(); i++) ans = min(ans, (vt[i - 1] + k - vt[i] + 1) / 2); cout << ans << '\n'; }

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

Main.cpp: In function 'int main()':
Main.cpp:23:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for (int i = 1; i < vt.size(); 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...