CODE FESTIVAL 2016 Exhibition

Submission #1333038

Source codeソースコード

#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;

int N; long long A[20002];

int main()
{
	scanf("%d", &N);
	for (int i = 0; i < N; i++) scanf("%lld", &A[i]);

	int ans = 0;
	for (long long p = 1, d = 0; d < 16; p *= 10, d++)
	{
		long long x = p * 10;
		for (int s = 9; s >= 0; s--) {
			vector<pair<long long, long long> > now;
			now.emplace_back(s * p, (s + 1) * p - 1);

			for (int i = 0; i < N; i++) {
				vector<pair<long long, long long> > nxt = now;
				for (auto &p : now) {
					long long s = (p.first - A[i] % x + x) % x;
					long long e = (p.second - A[i] % x + x) % x;
					if (s <= e) nxt.push_back({ s,e });
					else {
						nxt.push_back({ 0,e });
						nxt.push_back({ s,x - 1 });
					}
				}

				sort(nxt.begin(), nxt.end());
				long long s = nxt[0].first, e = nxt[0].second;
				now.clear();
				for (auto &p : nxt) {
					if (p.first <= e + 1) {
						e = p.second;
					}
					else {
						now.push_back({ s,e });
						s = p.first;
						e = p.second;
					}
				}
				now.push_back({ s,e });
			}

			if (now[0].first == 0) {
				ans += s;
				break;
			}
		}
	}
	printf("%d\n", ans);

	return 0;
}

Submission

Task問題 B - Exact Payment
User nameユーザ名 814
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 WA
Score得点 0
Source lengthソースコード長 1218 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main()’:
./Main.cpp:10:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &N);
^
./Main.cpp:11:50: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
for (int i = 0; i < N; i++) scanf("%lld", &A[i]);
^

Test case

Set

Set name Score得点 / Max score Cases
sample - sample-01.txt,sample-02.txt
All 0 / 1500 sample-01.txt,sample-02.txt,01-01.txt,01-02.txt,01-03.txt,01-04.txt,01-05.txt,01-06.txt,01-07.txt,01-08.txt,01-09.txt,01-10.txt,01-11.txt,01-12.txt,01-13.txt,01-14.txt,01-15.txt,01-16.txt,01-17.txt,01-18.txt,01-19.txt,01-20.txt,01-21.txt,01-22.txt,01-23.txt,01-24.txt,01-25.txt,01-26.txt,01-27.txt,01-28.txt,01-29.txt,01-30.txt,01-31.txt,01-32.txt,01-33.txt,01-34.txt,01-35.txt,01-36.txt,01-37.txt,01-38.txt,01-39.txt,01-40.txt,01-41.txt,01-42.txt,01-43.txt,01-44.txt,01-45.txt,01-46.txt,01-47.txt,01-48.txt,01-49.txt,01-50.txt,01-51.txt,01-52.txt,01-53.txt,01-54.txt,01-55.txt,01-56.txt,01-57.txt,01-58.txt,01-59.txt,01-60.txt,01-61.txt,01-62.txt,01-63.txt,01-64.txt,01-65.txt,01-66.txt,01-67.txt,01-68.txt,01-69.txt,01-70.txt,01-71.txt,01-72.txt,01-73.txt,01-74.txt,01-75.txt,01-76.txt,01-77.txt,01-78.txt,01-79.txt,01-80.txt,01-81.txt,01-82.txt,01-83.txt,01-84.txt,01-85.txt,01-86.txt,01-87.txt,01-88.txt,01-89.txt,01-90.txt,01-91.txt,01-92.txt,01-93.txt,01-94.txt,01-95.txt,01-96.txt,01-97.txt,01-98.txt,sample-01.txt,sample-02.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
01-01.txt AC 1 ms 256 KB
01-02.txt AC 1 ms 256 KB
01-03.txt AC 1 ms 256 KB
01-04.txt AC 1 ms 256 KB
01-05.txt AC 1 ms 256 KB
01-06.txt AC 51 ms 384 KB
01-07.txt WA
01-08.txt WA
01-09.txt AC 70 ms 384 KB
01-10.txt WA
01-11.txt WA
01-12.txt AC 62 ms 384 KB
01-13.txt WA
01-14.txt WA
01-15.txt AC 62 ms 384 KB
01-16.txt WA
01-17.txt AC 66 ms 384 KB
01-18.txt AC 66 ms 384 KB
01-19.txt AC 58 ms 384 KB
01-20.txt WA
01-21.txt WA
01-22.txt WA
01-23.txt AC 54 ms 384 KB
01-24.txt WA
01-25.txt WA
01-26.txt WA
01-27.txt AC 58 ms 512 KB
01-28.txt WA
01-29.txt WA
01-30.txt WA
01-31.txt WA
01-32.txt AC 60 ms 384 KB
01-33.txt AC 60 ms 384 KB
01-34.txt WA
01-35.txt WA
01-36.txt AC 59 ms 384 KB
01-37.txt AC 56 ms 384 KB
01-38.txt WA
01-39.txt WA
01-40.txt AC 54 ms 384 KB
01-41.txt AC 54 ms 384 KB
01-42.txt WA
01-43.txt WA
01-44.txt AC 55 ms 384 KB
01-45.txt WA
01-46.txt WA
01-47.txt AC 61 ms 384 KB
01-48.txt WA
01-49.txt AC 59 ms 384 KB
01-50.txt WA
01-51.txt WA
01-52.txt WA
01-53.txt WA
01-54.txt WA
01-55.txt WA
01-56.txt WA
01-57.txt WA
01-58.txt WA
01-59.txt WA
01-60.txt WA
01-61.txt WA
01-62.txt WA
01-63.txt WA
01-64.txt WA
01-65.txt WA
01-66.txt WA
01-67.txt AC 99 ms 384 KB
01-68.txt WA
01-69.txt WA
01-70.txt AC 63 ms 384 KB
01-71.txt AC 167 ms 384 KB
01-72.txt AC 169 ms 384 KB
01-73.txt WA
01-74.txt WA
01-75.txt AC 209 ms 384 KB
01-76.txt WA
01-77.txt AC 69 ms 384 KB
01-78.txt WA
01-79.txt WA
01-80.txt WA
01-81.txt WA
01-82.txt AC 148 ms 384 KB
01-83.txt WA
01-84.txt WA
01-85.txt WA
01-86.txt AC 189 ms 384 KB
01-87.txt AC 186 ms 384 KB
01-88.txt WA
01-89.txt AC 189 ms 384 KB
01-90.txt AC 55 ms 384 KB
01-91.txt AC 131 ms 384 KB
01-92.txt AC 161 ms 384 KB
01-93.txt AC 154 ms 384 KB
01-94.txt WA
01-95.txt WA
01-96.txt AC 58 ms 384 KB
01-97.txt AC 137 ms 384 KB
01-98.txt AC 140 ms 384 KB
sample-01.txt AC 1 ms 256 KB
sample-02.txt AC 1 ms 256 KB