QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#739639 | #9423. Gold Medal | zzisjtu | Compile Error | / | / | C++23 | 1.5kb | 2024-11-12 22:32:07 | 2024-11-12 22:32:07 |
Judging History
This is the latest submission verdict.
- [2024-11-12 22:32:07]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-11-12 22:32:07]
- Submitted
answer
#include <bits/stdc++.h>
#define int long long
#define all(x) x.begin(), x.end()
#define lowbit(i) ((i)&(-i))
#define pii pair<int,int>
#define endl '\n'
#define mk(x,y) make_pair(x,y)
#define popcount(x) __builtin_popcount(x)
#define LF(x) fixed<<setprecision(x)
const double pi = 3.14159265358979323846;
const double eps = 1e-9;
const int inf = 1e9;
const long long INF = 4e18;
const int mod = 1e9+7;
using namespace std;
const int N = 1e5+10;
int k;
struct node {
int x;
bool operator<(const node &a)const {
int tx = x % k, ty = a.x % k;
if (!tx)tx = k;
if (!ty)ty = k;
return tx >= ty;
}
};
void solve() {
int n; cin >> n >> k;
vector<node>a(n);
// for (auto& i : a)cin >> i;
for(int i = 0; i < n; i++)cin >> a[i];
// auto cmp = [&](int x, int y) -> bool {
// int tx = x % k, ty = y % k;
// if (!tx)tx = k;
// if (!ty)ty = k;
// return tx >= ty;
// };
sort(all(a));
int ret = 0;
int m; cin >> m;
for (int i = 0; i < n; i++) {
int t = a[i] % k;
if (t && m > k - t) {
a[i] += k - t;
m -= k - t;
}
ret += 0 + a[i] / k;
}
ret += 0 + m / k;
cout << ret << endl;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int T = 1;
cin >> T;
while (T--) {
solve();
}
return 0;
}
詳細信息
answer.code: In function ‘void solve()’: answer.code:31:35: error: no match for ‘operator>>’ (operand types are ‘std::istream’ {aka ‘std::basic_istream<char>’} and ‘__gnu_cxx::__alloc_traits<std::allocator<node>, node>::value_type’ {aka ‘node’}) 31 | for(int i = 0; i < n; i++)cin >> a[i]; In file included from /usr/include/c++/13/sstream:40, from /usr/include/c++/13/complex:45, from /usr/include/c++/13/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:127, from answer.code:1: /usr/include/c++/13/istream:325:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ 325 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/13/istream:325:25: note: no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<node>, node>::value_type’ {aka ‘node’} to ‘void*&’ 325 | operator>>(void*& __p) | ~~~~~~~^~~ /usr/include/c++/13/istream:293:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__gnu_cxx::__bfloat16_t&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __gnu_cxx::__bfloat16_t = __bf16]’ 293 | operator>>(__gnu_cxx::__bfloat16_t & __f) | ^~~~~~~~ /usr/include/c++/13/istream:293:44: note: no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<node>, node>::value_type’ {aka ‘node’} to ‘__gnu_cxx::__bfloat16_t&’ {aka ‘__bf16&’} 293 | operator>>(__gnu_cxx::__bfloat16_t & __f) | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/13/istream:269:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(_Float64&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ 269 | operator>>(_Float64& __f) | ^~~~~~~~ /usr/include/c++/13/istream:269:28: note: no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<node>, node>::value_type’ {aka ‘node’} to ‘_Float64&’ 269 | operator>>(_Float64& __f) | ~~~~~~~~~~^~~ /usr/include/c++/13/istream:257:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(_Float32&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ 257 | operator>>(_Float32& __f) | ^~~~~~~~ /usr/include/c++/13/istream:257:28: note: no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<node>, node>::value_type’ {aka ‘node’} to ‘_Float32&’ 257 | operator>>(_Float32& __f) | ~~~~~~~~~~^~~ /usr/include/c++/13/istream:231:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(_Float16&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ 231 | operator>>(_Float16& __f) | ^~~~~~~~ /usr/include/c++/13/istream:231:28: note: no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<node>, node>::value_type’ {aka ‘node’} to ‘_Float16&’ 231 | operator>>(_Float16& __f) | ~~~~~~~~~~^~~ /usr/include/c++/13/istream:224:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ 224 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/13/istream:224:31: note: no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<node>, node>::value_type’ {aka ‘node’} to ‘long double&’ 224 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/13/istream:220:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ 220 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/13/istream:220:26: note: no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<node>, node>::value_type’ {aka ‘node’} to ‘double&’ 220 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/13/istream:216:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_tr...