답안 #383580

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
383580 2021-03-30T10:40:48 Z maximath_1 Fibonacci representations (CEOI18_fib) C++11
5 / 100
185 ms 3308 KB
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <numeric>
#include <queue>
#include <assert.h>
#include <map>
#include <set>
#include <limits.h>
using namespace std;
 
#define ll long long
#define ld long double
const int MX = 100005;
const int LG = (int)log2(MX) + 2;
const int BLOCK = 105;
const ll mod = 1e9 + 7;
const ll inv2 = (mod + 1) / 2;
 
#define gc getchar//_unlocked //can't for window server
void cin(int &x){
	char c = gc(); bool neg = false;
	for(; c < '0'||'9' < c; c = gc())
		if(c == '-') neg=true;
	x = c - '0'; c = gc();
	for(; '0' <= c && c <= '9'; c = gc())
		x = (x << 1) + (x << 3) + (c - '0');
	if(neg) x = -x;
}

int f[25];
map<int, int> mp;

int main(){
	int n; cin(n);

	f[1] = 1, f[2] = 2;
	for(int i = 3; i <= 20; i ++)
		f[i] = f[i - 1] + f[i - 2];

	for(int i = 0; i < (1 << 20); i ++){
		int sm = 0;
		for(int j = 0; j < 20; j ++)
			if(i & (1 << j)) sm += f[j + 1];
		mp[sm] ++;
	}

	int cr = 0;
	for(int x, i = 0; i < n; i ++){
		cin(x);
		cr += f[x];
		printf("%d\n", mp[cr]);
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 166 ms 1644 KB Output is correct
2 Correct 168 ms 1772 KB Output is correct
3 Correct 178 ms 1640 KB Output is correct
4 Correct 172 ms 1648 KB Output is correct
5 Correct 173 ms 1644 KB Output is correct
6 Correct 165 ms 1772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 166 ms 1644 KB Output is correct
2 Correct 168 ms 1772 KB Output is correct
3 Correct 178 ms 1640 KB Output is correct
4 Correct 172 ms 1648 KB Output is correct
5 Correct 173 ms 1644 KB Output is correct
6 Correct 165 ms 1772 KB Output is correct
7 Correct 165 ms 1632 KB Output is correct
8 Incorrect 165 ms 1644 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 185 ms 1772 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 166 ms 1644 KB Output is correct
2 Correct 168 ms 1772 KB Output is correct
3 Correct 178 ms 1640 KB Output is correct
4 Correct 172 ms 1648 KB Output is correct
5 Correct 173 ms 1644 KB Output is correct
6 Correct 165 ms 1772 KB Output is correct
7 Correct 165 ms 1632 KB Output is correct
8 Incorrect 165 ms 1644 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 166 ms 3308 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 166 ms 1644 KB Output is correct
2 Correct 168 ms 1772 KB Output is correct
3 Correct 178 ms 1640 KB Output is correct
4 Correct 172 ms 1648 KB Output is correct
5 Correct 173 ms 1644 KB Output is correct
6 Correct 165 ms 1772 KB Output is correct
7 Correct 165 ms 1632 KB Output is correct
8 Incorrect 165 ms 1644 KB Output isn't correct
9 Halted 0 ms 0 KB -