QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#741227#8790. First Billionucup-team5657#Compile Error//C++202.0kb2024-11-13 13:52:392024-11-13 13:52:40

Judging History

你现在查看的是最新测评结果

  • [2024-11-13 13:52:40]
  • 评测
  • [2024-11-13 13:52:39]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define _rep(i_,a_,b_) for(int i_ = (a_); i_ <= (b_); ++i_)
#define mid ((L+R) >> 1)
#define multiCase() int testCnt = in(); _rep(curCase,1,testCnt)
#ifdef ONLINE_JUDGE
#define debug(...) 0
#else
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#endif
using ll = long long;
using pii = pair<int,int>;
using ull = unsigned long long;
const int inf = 0x3f3f3f3f;
const ll inf64 = 0x3f3f3f3f3f3f3f3fll;
int in(void) { int x; scanf("%d", &x); return x; } ll inl(void) { ll x; scanf("%lld", &x); return x; }
void out(int x) { printf("%d ", x); } void outln(int x) { printf("%d\n", x); }
void out(unsigned x) { printf("%u ", x); } void outln(unsigned x) { printf("%u\n", x); }
void out(ll x) { printf("%lld ", x); } void outln(ll x) { printf("%lld\n", x); }
void out(ull x) { printf("%llu ", x); } void outln(ull x) { printf("%llu\n", x); }
template<typename T, typename U> void chkmax(T &a, const U &b) { if(b > a) a = b; } 
template<typename T, typename U> void chkmin(T &a, const U &b) { if(b < a) a = b; } 
const int kN = 150;
int n, a[kN]; map<int,int> mp;
mt19937 umi(901);
int main() {
	n = in();
	_rep(i,1,n) a[i] = in(), mp[a[i]] = i;
	while(1) {
		shuffle(a + 1, a + 1 + n, umi);
		int s1 = 0, s2 = 0;
		_rep(i,1,n) {
			if(s1 > s2) s2 += a[i];
			else s1 += a[i];
		}
		if(s1 == 1e9 || s2 == 1e9) {
			s1 = s2 = 0;
			vector<int> id;
			_rep(i,1,n) 
				if(s1 > s2) s2 += a[i], id.emplace_back(a[i]); 
				else s1 += a[i];
			outln(id.size());
			for(auto &i : id) out(mp[i]); puts("");
			exit(0);
		}
	}
	return 0;
}

/* 
a list of keywords
clear empty push_back pop_back push pop top front back
emplace_back emplace push_front pop_front insert erase
find count set reset bitset map vector string multiset
first second iterator prev next deque multimap reverse
sort begin end list modify query init check calc prime
putchar getchar puts scanf printf max min swap replace
make_pair make_tuple numeric_limits auto function null
*/

Details

answer.code: In function ‘int main()’:
answer.code:42:30: error: call of overloaded ‘outln(std::vector<int>::size_type)’ is ambiguous
   42 |                         outln(id.size());
      |                         ~~~~~^~~~~~~~~~~
answer.code:17:44: note: candidate: ‘void outln(int)’
   17 | void out(int x) { printf("%d ", x); } void outln(int x) { printf("%d\n", x); }
      |                                            ^~~~~
answer.code:18:49: note: candidate: ‘void outln(unsigned int)’
   18 | void out(unsigned x) { printf("%u ", x); } void outln(unsigned x) { printf("%u\n", x); }
      |                                                 ^~~~~
answer.code:19:45: note: candidate: ‘void outln(ll)’
   19 | void out(ll x) { printf("%lld ", x); } void outln(ll x) { printf("%lld\n", x); }
      |                                             ^~~~~
answer.code:20:46: note: candidate: ‘void outln(ull)’
   20 | void out(ull x) { printf("%llu ", x); } void outln(ull x) { printf("%llu\n", x); }
      |                                              ^~~~~
answer.code: In function ‘int in()’:
answer.code:16:28: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 | int in(void) { int x; scanf("%d", &x); return x; } ll inl(void) { ll x; scanf("%lld", &x); return x; }
      |                       ~~~~~^~~~~~~~~~
answer.code: In function ‘ll inl()’:
answer.code:16:78: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 | int in(void) { int x; scanf("%d", &x); return x; } ll inl(void) { ll x; scanf("%lld", &x); return x; }
      |                                                                         ~~~~~^~~~~~~~~~~~