Submission #377920

# Submission time Handle Problem Language Result Execution time Memory
377920 2021-03-15T14:44:07 Z Thistle Packing Biscuits (IOI20_biscuits) C++14
0 / 100
1 ms 364 KB
#include "biscuits.h"
#include <vector>
#include<iostream>
#include<algorithm>
#include<unordered_map>
using namespace std;
using ll=long long;
using H=pair<ll, ll>;
using vi=vector<ll>;
#define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define rep(i,n) rng((i),(0),(n))
#define pb push_back
#define vec vector
#define all(a) (a).begin(),(a).end()
#define fs first
#define sc second
#define siz(a) ll((a).size())


long long count_tastiness(long long x, std::vector<long long> a) {
	ll k=siz(a);
	unordered_map<ll, ll>mp[2];
	//remain cookie -> able number
	mp[0][0]=1;
	rep(i,k){
		auto& now=mp[i&1];
		auto& nxt=mp[(i+1)&1];
		nxt.clear();
		for(auto g:now){
			ll t=g.fs;
			t+=a[i];
			if(t>=x) nxt[(t-x)>>1]+=g.sc;
			nxt[t>>1]+=g.sc;
		}
	}

	ll ans=0;
	for(auto g:mp[k&1]){
		ans+=g.sc;
	}
	return ans;
}

Compilation message

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:10:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
biscuits.cpp:11:18: note: in expansion of macro 'rng'
   11 | #define rep(i,n) rng((i),(0),(n))
      |                  ^~~
biscuits.cpp:25:2: note: in expansion of macro 'rep'
   25 |  rep(i,k){
      |  ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -