Submission #372630


Source Code Expand

#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
#define F first
#define S second
#define PB push_back
#define BE(c) c.begin(),c.end()
using namespace std;
typedef long long LL;
typedef int ut;
typedef pair<ut,ut> pr;
typedef vector<ut> VI;
typedef vector<pr> Vpr;
const int SIZE=1010;
const int INF=1<<30;
Vpr nums;
map<LL,LL> segmax,segsum;
LL sc[100];
LL scale(int x){
	if(sc[x]) return sc[x];
	if(x) return sc[x]=10*scale(x-1);
	return 1;
}
void update(int x,LL val){
	segmax[x]=max(segmax[x],val);
	if(x)
		update(x%scale(log10(x)),segmax[x]+segsum[x]);
}
void add(int x,LL b){
	segsum[x]+=b;
	update(x%scale(log10(x)),segsum[x]+segmax[x]);
}
int main(){
	ut N,a,b;
	cin >> N;
	REP(i,N){
		scanf("%lld%lld",&a,&b);
		add(a,b);
		printf("%lld\n",segmax[0]);
	}
	return 0;
}

Submission Info

Submission Time
Task E - 宝くじ
User probako
Language C++ (GCC 4.9.2)
Score 200
Code Size 866 Byte
Status AC
Exec Time 1449 ms
Memory 53304 KiB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:37:25: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 2 has type ‘ut* {aka int*}’ [-Wformat=]
   scanf("%lld%lld",&a,&b);
                         ^
./Main.cpp:37:25: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 3 has type ‘ut* {aka int*}’ [-Wformat=]
./Main.cpp:37:26: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld%lld",&a,&b);
                          ^

Judge Result

Set Name All
Score / Max Score 200 / 200
Status
AC × 25
Set Name Test Cases
All scrambled_00.txt, scrambled_01.txt, scrambled_02.txt, scrambled_03.txt, scrambled_04.txt, scrambled_05.txt, scrambled_06.txt, scrambled_07.txt, scrambled_08.txt, scrambled_09.txt, scrambled_10.txt, scrambled_11.txt, scrambled_12.txt, scrambled_13.txt, scrambled_14.txt, scrambled_15.txt, scrambled_16.txt, scrambled_17.txt, scrambled_18.txt, scrambled_19.txt, scrambled_20.txt, scrambled_21.txt, scrambled_22.txt, scrambled_23.txt, scrambled_24.txt
Case Name Status Exec Time Memory
scrambled_00.txt AC 22 ms 800 KiB
scrambled_01.txt AC 26 ms 808 KiB
scrambled_02.txt AC 199 ms 800 KiB
scrambled_03.txt AC 191 ms 800 KiB
scrambled_04.txt AC 196 ms 804 KiB
scrambled_05.txt AC 149 ms 800 KiB
scrambled_06.txt AC 172 ms 804 KiB
scrambled_07.txt AC 74 ms 932 KiB
scrambled_08.txt AC 107 ms 920 KiB
scrambled_09.txt AC 157 ms 804 KiB
scrambled_10.txt AC 137 ms 924 KiB
scrambled_11.txt AC 61 ms 796 KiB
scrambled_12.txt AC 134 ms 796 KiB
scrambled_13.txt AC 49 ms 916 KiB
scrambled_14.txt AC 651 ms 24872 KiB
scrambled_15.txt AC 45 ms 1968 KiB
scrambled_16.txt AC 627 ms 24104 KiB
scrambled_17.txt AC 100 ms 4900 KiB
scrambled_18.txt AC 587 ms 23080 KiB
scrambled_19.txt AC 987 ms 25792 KiB
scrambled_20.txt AC 1449 ms 53304 KiB
scrambled_21.txt AC 870 ms 35244 KiB
scrambled_22.txt AC 874 ms 34968 KiB
scrambled_23.txt AC 167 ms 8864 KiB
scrambled_24.txt AC 352 ms 17004 KiB