QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#234498#5044. HappinessCSU2023AC ✓601ms5464kbC++143.1kb2023-11-01 18:04:312023-11-01 18:04:31

Judging History

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

  • [2023-11-01 18:04:31]
  • 评测
  • 测评结果:AC
  • 用时:601ms
  • 内存:5464kb
  • [2023-11-01 18:04:31]
  • 提交

answer

#include<bits/stdc++.h>
#define LL long long
#define mk make_pair
#define pii std::pair<int,int>
#define fi first
#define se second
const int N = 305;
const int M = 11;
const int INF = 1e9;
using std::cin;
using std::cout;
using std::ios;
using std::max;
using std::min;
using std::vector;
int n,m,F,L;
pii a[N][N],b[N][N];
int fir[N],las[N];
int dirt[N];
int sum[N];
int rk[N],p[N];
vector <int> t1[N];
inline int read(){
	int v = 0,c = 1;char ch = getchar();
	while(!isdigit(ch)){
		if(ch == '-') return -1;
		ch = getchar();
	}
	while(isdigit(ch)){
		v = v * 10 + ch - 48;
		ch = getchar();
	}
	return v * c;
}
inline bool cmpl(int x,int y){
	assert(t1[x].size() == t1[y].size());
	for(int i = 0;i < (int)t1[x].size();++i){
		if(t1[x][i] < t1[y][i]) return 1;
		if(t1[x][i] > t1[y][i]) return 0;	
	}
	return x == n;
}
inline bool cmp(int x,int y){
	return (sum[x] > sum[y]) || (sum[x] == sum[y] && dirt[x] < dirt[y]) || 
	(sum[x] == sum[y] && dirt[x] == dirt[y] && cmpl(x,y));
}
inline int work(){
	int now = 0,s = 0,d = 0;
	for(int i = 1;i <= 10;++i) b[n][i].fi = -1;
	for(int i = 1;i <= 10;++i){
		if(a[n][p[i]].fi == -1) continue;
		if(now + a[n][p[i]].fi <= 300){
			now += a[n][p[i]].fi;
			s++;d += now + a[n][p[i]].se * 20;
			b[n][p[i]].fi = now;
			b[n][p[i]].se = a[n][p[i]].se;
		}
		else break;
	}
	sum[n] = s,dirt[n] = d;

	t1[n].clear();
	for(int i = 1;i <= 10;++i) if(b[n][i].fi != -1) t1[n].push_back(b[n][i].fi);
	sort(t1[n].begin(),t1[n].end());
	reverse(t1[n].begin(), t1[n].end());
	
	int l = 1,r = n - 1,res = n;
	while(l <= r){
		int mid = (l + r) >> 1;
		if(cmp(n,rk[mid])) res = mid,r = mid - 1;
		else l = mid + 1;	
	}
//	printf("case : %d %d %d\n",sum[n],dirt[n],res);
	int cnt = 5000 / res;
	if(res <= n / 10) cnt += 1200;
	else if(res <= n / 10 * 3) cnt += 800;
	else if(res <= n / 10 * 6) cnt += 400;
	int ff = INF,ll = -1;
	for(int i = 1;i <= 10;++i){
		if(b[n][i].fi == -1) continue;	
		if(b[n][i].fi <= fir[i]) cnt += 800;
		ff = min(ff,b[n][i].fi);
		ll = max(ll,b[n][i].fi);
	}
	if(ff != INF && ff <= F) cnt += 700;
	if(ll != -1 && ll >= L) cnt += 500;
	return cnt;
}
int main(){
	n = read();
	for(int i = 1;i <= 300;++i) fir[i] = INF, las[i] = -1,rk[i] = i,F = INF,L = -1;
	for(int i = 1;i <= n;++i){
		for(int j = 1;j <= 10;++j){
			a[i][j].fi = read();
			if(a[i][j].fi == -1) continue;
			a[i][j].se = read();
			if(i == n) continue;
			dirt[i] += a[i][j].fi + a[i][j].se * 20;
			sum[i]++;
			fir[j] = min(fir[j],a[i][j].fi);
			las[j] = max(las[j],a[i][j].fi);
		//	printf("%d %d\n",a[i][j].fi,a[i][j].se);	
		}
	}
	for(int i = 1;i < n;++i){
		for(int j = 1;j <= 10;++j){
			b[i][j] = a[i][j];	
			if(b[i][j].fi != -1) t1[i].push_back(a[i][j].fi);
		}
		sort(t1[i].begin(),t1[i].end());
		reverse(t1[i].begin(), t1[i].end());
	}
	for(int i = 1;i <= 10;++i) F = min(F,fir[i]),L = max(L,las[i]);//,cout << fir[i] << " " << las[i] << "\n";
	int ans = 0;
	std::sort(rk + 1,rk + n,cmp);
	for(int i = 1;i <= 10;++i) p[i] = i;
	do{
		ans = max(ans,work());
	}while(std::next_permutation(p + 1,p + 11));
	printf("%d\n",ans);
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 92ms
memory: 3940kb

input:

10
233 1,-,-,7 7,257 4,173 5,117 1,-,-,85 3
-,231 0,167 0,257 7,-,-,122 4,283 0,215 4,-
41 1,-,290 8,-,-,-,-,246 7,120 3,184 9
142 8,243 7,69 0,-,41 9,-,279 1,264 4,-,74 9
53 8,-,187 9,60 1,48 8,99 10,-,-,55 7,259 5
250 0,-,-,-,166 0,16 3,-,82 4,73 0,184 3
-,-,-,-,105 3,-,-,-,152 4,-
-,84 5,98 8,-,1...

output:

1800

result:

ok 1 number(s): "1800"

Test #2:

score: 0
Accepted
time: 88ms
memory: 3928kb

input:

10
15 0,19 10,152 4,45 10,154 7,172 3,168 4,263 1,187 7,24 4
2 3,93 5,113 7,160 0,274 4,128 8,119 0,46 6,50 5,129 2
117 8,190 1,202 1,69 1,64 5,218 0,148 2,156 7,86 2,162 5
209 1,145 0,214 2,99 10,9 1,47 5,235 5,87 3,250 10,285 5
245 0,150 1,237 8,182 7,4 3,38 5,238 6,164 2,259 3,59 6
31 8,44 9,27 6...

output:

1300

result:

ok 1 number(s): "1300"

Test #3:

score: 0
Accepted
time: 123ms
memory: 5260kb

input:

300
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,...

output:

6200

result:

ok 1 number(s): "6200"

Test #4:

score: 0
Accepted
time: 91ms
memory: 5272kb

input:

300
164 7,180 10,59 4,162 10,16 3,140 1,204 10,73 9,289 5,14 8
97 3,18 1,153 4,160 6,166 10,25 8,300 9,183 8,98 10,195 10
195 5,247 10,116 1,129 7,79 5,238 7,198 3,192 2,282 7,117 2
125 1,269 10,188 9,72 8,65 5,249 5,46 1,192 3,77 0,241 3
18 1,147 0,12 6,34 9,120 3,282 4,44 1,206 2,50 10,125 10
174 ...

output:

16

result:

ok 1 number(s): "16"

Test #5:

score: 0
Accepted
time: 104ms
memory: 5316kb

input:

300
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,...

output:

9800

result:

ok 1 number(s): "9800"

Test #6:

score: 0
Accepted
time: 120ms
memory: 5452kb

input:

300
171 8,75 1,-,190 7,44 5,-,10 9,72 1,63 2,-
295 0,-,60 10,-,64 7,-,-,-,-,-
247 8,67 10,-,-,93 1,-,69 4,90 1,-,-
278 1,206 7,-,-,22 4,97 1,-,156 1,227 0,276 4
245 6,111 5,-,-,281 10,44 7,266 4,-,130 5,-
244 7,-,-,-,183 9,118 7,-,-,123 8,158 2
63 5,-,-,117 3,286 7,-,-,-,278 1,151 5
291 1,223 6,-,-,...

output:

20

result:

ok 1 number(s): "20"

Test #7:

score: 0
Accepted
time: 111ms
memory: 5280kb

input:

300
259 1,62 0,98 6,-,245 4,269 5,66 3,203 4,207 3,196 5
299 1,185 3,-,254 4,146 1,-,33 4,150 7,274 1,24 5
13 6,169 7,265 5,299 8,190 4,251 5,63 5,75 10,153 2,60 10
258 8,205 8,251 7,290 6,7 8,77 3,-,60 4,271 2,25 10
-,184 10,21 10,198 3,-,215 7,-,166 6,142 5,140 6
194 0,27 0,91 9,117 3,196 5,163 10...

output:

16

result:

ok 1 number(s): "16"

Test #8:

score: 0
Accepted
time: 127ms
memory: 5392kb

input:

300
139 2,-,-,68 5,290 9,146 8,128 10,192 6,67 6,-
-,-,291 4,50 1,286 2,260 9,222 0,120 8,186 8,-
95 9,46 10,91 4,53 7,135 7,197 9,240 2,111 1,-,-
118 1,-,-,295 7,56 7,139 4,-,-,102 10,260 2
277 4,39 4,256 2,56 5,106 6,11 0,-,116 2,39 2,238 0
246 1,117 9,267 10,-,-,285 0,222 5,283 3,275 9,-
-,97 10,...

output:

16

result:

ok 1 number(s): "16"

Test #9:

score: 0
Accepted
time: 167ms
memory: 5328kb

input:

300
227 4,110 9,54 1,257 7,297 10,292 4,-,-,115 7,297 5
118 2,15 10,-,245 10,165 10,215 6,-,156 8,29 6,7 8
-,-,72 3,49 3,250 6,-,-,276 3,145 9,49 3
156 6,239 0,-,-,167 10,174 2,24 8,-,178 1,-
111 5,225 6,63 6,190 8,293 6,119 6,-,-,295 4,-
10 8,279 8,187 1,71 6,169 3,42 9,284 9,61 8,251 1,37 8
-,-,15...

output:

17

result:

ok 1 number(s): "17"

Test #10:

score: 0
Accepted
time: 120ms
memory: 5280kb

input:

300
15 7,96 8,198 9,298 4,106 4,246 6,206 0,69 9,228 8,288 6
196 5,216 5,222 7,134 3,52 9,108 3,17 1,261 3,197 9,1 3
258 5,135 0,192 0,77 2,90 2,260 0,155 4,37 6,235 9,133 4
207 6,49 5,8 9,75 0,116 9,180 8,227 0,124 0,244 5,193 3
285 0,120 3,-,244 4,190 1,54 6,109 2,84 10,-,262 0
166 4,47 3,228 3,37...

output:

516

result:

ok 1 number(s): "516"

Test #11:

score: 0
Accepted
time: 270ms
memory: 5312kb

input:

300
-,98 7,-,232 5,-,-,-,67 3,-,-
205 9,-,112 4,-,-,-,-,118 1,-,-
-,56 3,-,-,28 2,-,72 0,-,-,-
-,-,-,-,-,-,208 5,-,126 5,-
-,-,-,151 7,89 10,230 5,-,285 7,163 5,277 0
84 0,-,108 9,-,-,-,-,-,184 2,-
-,-,-,-,-,-,-,93 3,-,-
247 5,-,70 7,-,45 1,277 0,201 6,-,-,-
-,-,-,-,-,97 1,-,-,47 8,129 0
-,-,-,-,-,1...

output:

919

result:

ok 1 number(s): "919"

Test #12:

score: 0
Accepted
time: 298ms
memory: 5260kb

input:

300
-,-,-,249 0,262 6,-,-,189 3,207 0,256 3
-,279 4,184 4,124 6,216 5,-,94 2,268 7,-,-
-,-,37 5,214 8,-,-,-,213 1,220 3,13 6
21 9,135 8,-,253 9,107 7,121 3,66 7,-,-,-
45 4,270 1,-,296 5,-,-,272 8,91 10,137 10,68 9
-,259 6,-,-,189 7,-,73 5,-,23 0,233 2
-,104 7,-,152 9,94 7,-,120 5,-,194 4,-
-,-,151 6...

output:

867

result:

ok 1 number(s): "867"

Test #13:

score: 0
Accepted
time: 339ms
memory: 5284kb

input:

300
-,197 2,-,185 1,-,208 9,47 2,245 3,206 7,85 0
231 5,-,-,-,33 4,164 8,-,-,36 1,128 6
123 0,272 3,-,82 1,235 6,251 7,-,233 6,-,-
-,199 0,244 2,113 8,287 9,100 3,-,157 7,5 9,10 8
235 6,240 7,238 4,94 0,-,162 6,295 8,34 4,-,-
-,265 9,266 9,209 6,-,65 6,47 4,168 10,256 2,234 4
133 9,13 7,110 4,201 8,...

output:

855

result:

ok 1 number(s): "855"

Test #14:

score: 0
Accepted
time: 113ms
memory: 5388kb

input:

300
-,233 2,-,-,76 3,-,106 5,-,127 9,51 1
-,-,-,-,93 9,127 1,202 7,-,-,-
-,-,77 3,-,-,-,-,-,231 1,-
-,-,2 9,211 10,182 10,299 5,145 2,-,-,-
232 0,-,263 5,29 9,-,-,138 4,-,-,-
278 5,40 7,249 8,-,-,80 2,-,-,211 0,286 5
135 8,276 9,215 3,186 7,282 1,-,-,224 0,51 5,-
-,274 6,-,-,93 6,-,171 10,174 6,-,18...

output:

17

result:

ok 1 number(s): "17"

Test #15:

score: 0
Accepted
time: 201ms
memory: 5316kb

input:

300
120 1,272 2,-,291 9,204 7,236 9,-,-,-,-
-,220 3,-,158 2,61 1,83 3,-,133 9,-,280 10
183 1,274 3,-,248 9,3 2,267 8,288 0,252 10,93 0,-
121 5,-,-,212 0,128 6,-,226 4,175 2,-,41 6
-,-,76 0,182 9,188 2,174 5,227 2,39 0,209 9,143 7
-,26 1,31 5,-,30 0,-,-,154 8,74 7,297 4
6 2,40 3,86 6,-,8 1,20 7,-,163...

output:

1522

result:

ok 1 number(s): "1522"

Test #16:

score: 0
Accepted
time: 381ms
memory: 5344kb

input:

300
208 2,50 1,290 4,77 2,236 7,-,-,40 0,269 3,230 4
-,89 3,264 2,84 0,130 8,268 9,-,132 6,93 9,161 10
221 3,106 6,-,162 5,48 10,-,212 6,34 6,21 8,-
164 1,120 10,-,277 2,174 4,220 8,272 4,82 9,160 2,86 4
-,15 7,-,105 9,33 2,157 9,-,170 8,-,-
135 2,-,201 8,5 6,72 2,187 1,154 10,123 7,109 7,234 8
272 ...

output:

1372

result:

ok 1 number(s): "1372"

Test #17:

score: 0
Accepted
time: 287ms
memory: 5328kb

input:

300
-,-,243 1,-,-,189 3,-,-,-,-
-,-,211 4,-,-,-,104 8,-,-,146 10
-,-,-,-,-,-,-,279 3,-,-
63 7,-,289 5,-,81 5,-,-,37 2,91 1,-
158 2,300 6,189 5,-,-,-,-,171 1,-,77 2
16 2,-,-,-,-,-,-,-,3 4,170 5
-,-,122 0,-,-,-,-,234 1,84 9,-
151 8,176 0,-,190 2,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
196 0,-,-,73 9,-,-,-,61 ...

output:

7000

result:

ok 1 number(s): "7000"

Test #18:

score: 0
Accepted
time: 153ms
memory: 5320kb

input:

300
172 10,218 9,92 7,154 2,234 8,236 5,111 6,-,23 3,-
-,57 1,19 0,76 5,-,-,-,-,255 5,-
205 8,284 9,280 10,202 6,30 0,79 10,271 7,-,137 1,-
92 5,26 2,38 5,162 4,-,68 2,300 8,159 1,103 8,40 3
-,-,117 1,235 1,50 0,236 4,298 8,46 2,40 4,264 8
-,166 3,289 2,245 4,158 10,-,140 9,79 9,-,159 5
-,-,229 2,-,...

output:

16

result:

ok 1 number(s): "16"

Test #19:

score: 0
Accepted
time: 190ms
memory: 5264kb

input:

300
-,-,-,-,51 4,-,-,180 6,-,290 1
-,-,-,-,-,-,-,227 7,-,165 7
-,-,-,-,-,-,77 7,35 4,-,189 9
14 4,-,-,-,-,-,-,-,-,-
-,21 1,22 0,166 3,30 8,-,296 7,-,-,-
-,-,-,-,46 10,-,-,-,-,95 4
-,-,-,-,-,-,52 7,-,292 4,-
135 1,254 2,-,-,166 3,-,78 4,-,113 3,-
-,-,-,-,-,-,-,-,-,-
-,-,29 9,-,177 6,-,188 0,-,-,-
-,-...

output:

1616

result:

ok 1 number(s): "1616"

Test #20:

score: 0
Accepted
time: 460ms
memory: 5396kb

input:

300
146 0,226 0,48 4,148 1,218 0,263 5,270 0,143 2,14 8,163 5
277 8,112 5,146 4,141 9,87 8,2 9,203 4,145 8,184 8,127 2
223 1,33 5,287 6,297 7,217 6,108 2,15 10,111 8,292 2,67 8
197 2,43 4,132 6,54 2,204 2,290 10,210 6,235 6,243 2,241 9
87 5,262 9,300 3,234 7,49 7,212 10,227 10,232 5,60 9,207 6
67 8,...

output:

2200

result:

ok 1 number(s): "2200"

Test #21:

score: 0
Accepted
time: 444ms
memory: 5464kb

input:

300
9 5,68 6,259 8,155 2,120 2,220 0,167 4,31 8,30 6,286 7
149 7,66 9,236 8,52 0,76 2,42 8,258 1,255 4,184 8,19 6
85 10,188 6,13 9,66 2,79 6,128 10,214 0,268 7,285 1,43 10
31 3,207 3,23 1,279 4,176 4,271 1,195 7,73 0,8 10,201 1
93 4,222 8,123 7,54 4,14 5,274 1,6 2,208 6,124 5,152 5
114 2,43 10,160 0...

output:

7700

result:

ok 1 number(s): "7700"

Test #22:

score: 0
Accepted
time: 451ms
memory: 5352kb

input:

300
12 3,174 7,36 10,69 0,34 2,215 10,109 9,260 10,190 6,59 4
41 10,294 9,192 0,230 4,129 0,24 4,239 1,252 6,200 10,298 9
122 6,36 2,149 2,70 4,99 2,226 1,72 10,176 3,102 2,134 4
246 9,17 9,210 5,159 6,197 5,179 5,54 10,121 2,201 5,175 10
68 2,5 10,7 9,57 8,60 9,275 6,253 5,191 0,37 8,282 2
130 8,16...

output:

1825

result:

ok 1 number(s): "1825"

Test #23:

score: 0
Accepted
time: 477ms
memory: 5284kb

input:

300
183 8,15 1,239 3,76 1,32 4,164 5,14 3,156 5,10 6,191 6
110 7,249 2,282 2,141 4,222 5,252 2,285 8,167 0,95 9,189 2
172 5,191 2,280 6,35 9,261 2,49 0,167 3,137 3,199 2,7 7
88 8,85 6,297 1,84 9,178 6,152 6,38 0,268 7,266 4,30 4
81 2,265 9,130 2,74 3,26 9,38 8,227 10,167 3,102 5,123 1
169 4,27 0,225...

output:

1700

result:

ok 1 number(s): "1700"

Test #24:

score: 0
Accepted
time: 396ms
memory: 5284kb

input:

300
54 4,-,293 2,219 1,197 8,-,-,-,112 8,-
-,-,-,-,-,201 4,-,-,121 3,-
226 6,100 10,296 1,-,-,-,-,97 1,-,-
-,300 6,-,-,41 9,48 3,151 1,61 3,-,199 2
-,7 4,142 3,-,46 6,245 0,213 10,206 2,82 7,-
-,29 4,12 10,163 10,-,165 5,-,289 10,-,26 0
272 7,-,201 5,-,-,295 5,166 2,-,-,-
-,231 6,194 3,276 0,98 9,-,...

output:

7000

result:

ok 1 number(s): "7000"

Test #25:

score: 0
Accepted
time: 173ms
memory: 3868kb

input:

10
16 4,97 6,66 8,216 10,259 8,88 2,256 5,293 7,164 3,178 3
258 8,213 3,96 10,159 0,63 4,230 7,248 1,-,58 8,167 3
41 8,237 9,243 9,265 5,280 7,59 2,46 6,124 2,208 10,69 7
144 8,-,280 4,58 3,38 1,258 9,234 1,21 7,-,189 5
25 5,217 6,-,227 1,50 2,235 0,-,262 0,43 9,120 9
48 7,128 0,212 2,-,217 7,50 10,...

output:

1300

result:

ok 1 number(s): "1300"

Test #26:

score: 0
Accepted
time: 144ms
memory: 4992kb

input:

230
72 4,237 3,-,-,-,245 9,-,285 7,110 5,-
-,179 9,-,168 8,175 10,-,170 6,-,-,18 2
-,-,60 8,-,197 0,120 8,197 5,50 5,254 9,92 7
196 9,74 0,238 10,142 7,-,179 6,130 4,216 4,92 3,229 1
179 6,114 5,140 5,-,129 6,-,-,-,17 3,129 10
-,-,135 9,91 0,-,-,-,128 4,-,188 8
-,263 6,-,-,-,101 3,285 2,-,-,195 4
90...

output:

22

result:

ok 1 number(s): "22"

Test #27:

score: 0
Accepted
time: 401ms
memory: 4192kb

input:

60
-,88 10,80 1,109 8,-,195 1,17 9,239 1,65 10,92 9
78 3,73 8,-,289 2,197 5,163 1,-,22 0,-,167 5
112 0,237 2,145 2,-,-,-,37 9,171 2,-,203 6
297 7,14 0,236 1,34 10,6 9,113 1,14 9,116 5,-,139 8
157 1,19 1,100 3,133 5,285 0,69 6,177 7,48 2,226 5,257 2
-,-,11 4,-,168 2,165 8,-,-,13 0,49 5
259 4,173 6,19...

output:

9300

result:

ok 1 number(s): "9300"

Test #28:

score: 0
Accepted
time: 119ms
memory: 4832kb

input:

200
287 2,-,283 6,116 0,61 7,-,271 8,88 5,139 9,272 10
191 4,230 0,159 7,71 4,191 5,18 0,155 6,51 9,54 10,-
220 0,53 0,28 7,185 7,211 3,160 3,197 1,77 0,47 6,13 5
239 0,-,118 9,185 1,118 1,145 10,63 3,204 1,82 10,260 6
195 2,-,2 9,-,295 3,245 6,273 6,90 6,277 9,-
212 3,20 4,-,208 8,63 6,57 2,8 0,117...

output:

25

result:

ok 1 number(s): "25"

Test #29:

score: 0
Accepted
time: 132ms
memory: 5160kb

input:

280
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,165 9,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,...

output:

2450

result:

ok 1 number(s): "2450"

Test #30:

score: 0
Accepted
time: 285ms
memory: 5088kb

input:

250
-,-,185 6,234 7,215 2,42 5,184 0,181 1,-,-
48 1,53 7,-,55 10,240 9,277 9,-,-,173 0,297 7
39 1,186 3,240 7,215 3,-,137 10,296 1,221 9,198 8,-
71 8,-,67 1,167 4,164 2,-,54 9,263 1,114 10,-
-,277 7,90 2,237 4,84 10,8 5,238 10,284 7,12 6,-
188 7,94 8,98 3,-,100 9,212 7,64 8,196 1,111 3,184 4
279 0,1...

output:

22

result:

ok 1 number(s): "22"

Test #31:

score: 0
Accepted
time: 108ms
memory: 4312kb

input:

90
265 0,139 4,-,221 3,62 1,259 7,43 3,266 2,14 2,51 3
227 9,83 0,-,290 10,196 6,34 6,72 4,287 9,1 3,273 5
154 2,86 9,176 9,85 7,210 6,74 5,192 1,175 4,181 9,93 7
36 3,205 5,84 7,180 6,300 10,244 10,144 7,176 3,97 2,60 9
153 9,30 8,9 7,-,16 2,108 8,146 1,181 4,83 6,47 1
294 2,112 1,113 2,102 0,189 6...

output:

555

result:

ok 1 number(s): "555"

Test #32:

score: 0
Accepted
time: 277ms
memory: 5012kb

input:

250
-,-,-,3 6,-,-,-,-,251 0,78 8
-,-,277 8,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,120 0
-,-,238 3,-,-,173 9,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,184 1,-,272 9,-,242 1
-,-,-,-,-,102 9,-,87 3,-,55 7
-,-,-,-,134 4,-,-,-,-,-
234 1,255 2,-,-,-,-,-,-,-,-
-,-,131 1,-,-,-,3...

output:

3700

result:

ok 1 number(s): "3700"

Test #33:

score: 0
Accepted
time: 373ms
memory: 4312kb

input:

90
243 0,217 3,189 1,271 7,274 3,45 2,-,279 9,294 2,247 1
292 10,265 4,113 7,124 10,137 9,165 0,292 10,175 8,-,135 5
164 9,78 1,115 4,25 10,161 3,97 2,79 8,7 5,259 9,14 10
214 3,114 8,279 5,270 0,298 9,78 0,158 6,238 5,200 3,102 10
77 3,56 6,32 8,-,187 1,159 9,222 8,33 6,45 9,79 4
123 9,206 5,158 1,...

output:

555

result:

ok 1 number(s): "555"

Test #34:

score: 0
Accepted
time: 100ms
memory: 3932kb

input:

10
102 0,-,-,-,-,183 1,-,-,-,-
-,-,-,231 4,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,123 7,-,-,-
72 9,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,229 10,-,-,-,-,-,-,-
-,-,-,-,-,-,-,284 10,-,-
-,-,-,-,-,-,110 10,224 10,-,-

output:

2450

result:

ok 1 number(s): "2450"

Test #35:

score: 0
Accepted
time: 240ms
memory: 5324kb

input:

300
-,-,88 3,-,-,73 9,-,77 7,104 1,-
-,-,-,270 1,-,162 8,-,-,-,-
-,-,-,-,-,-,99 6,-,-,-
-,-,-,-,-,290 3,-,-,279 0,199 1
-,-,-,-,20 10,58 1,-,4 1,-,-
293 4,-,-,-,-,-,225 0,-,-,195 4
-,290 5,-,-,-,200 8,-,11 9,-,-
-,17 2,-,-,-,-,-,-,-,-
-,98 10,-,-,-,-,-,146 5,-,81 10
176 0,-,-,-,-,-,-,-,-,-
-,-,20 1,...

output:

2033

result:

ok 1 number(s): "2033"

Test #36:

score: 0
Accepted
time: 238ms
memory: 5148kb

input:

280
213 10,140 7,159 9,137 2,130 2,7 10,5 0,214 8,148 7,272 1
117 10,125 7,94 4,161 10,224 2,26 4,160 0,161 6,172 1,149 10
174 4,284 4,14 1,57 5,135 5,204 10,299 7,81 0,132 4,181 4
67 9,3 8,232 10,293 3,168 1,56 9,209 9,104 6,142 3,185 5
29 6,11 1,259 2,163 7,164 5,260 5,20 1,267 10,75 4,207 9
129 0...

output:

817

result:

ok 1 number(s): "817"

Test #37:

score: 0
Accepted
time: 125ms
memory: 4720kb

input:

190
73 10,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
74 2,-,-,149 8,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,167 8,-,250 10,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
193 9,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,253 9,-,-,-,-
-,-,279 4,138 1,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,274 5,-,-,234 3,-
-,157 5,-,-,...

output:

2450

result:

ok 1 number(s): "2450"

Test #38:

score: 0
Accepted
time: 141ms
memory: 3940kb

input:

30
-,111 3,23 0,-,-,170 7,-,-,-,15 9
-,-,-,61 1,-,-,84 8,-,-,-
247 8,-,-,-,-,285 6,-,-,179 4,-
28 8,-,215 0,-,-,-,-,-,-,-
20 6,-,-,46 0,-,-,67 5,-,-,53 3
-,-,-,-,-,-,-,52 5,-,-
263 10,-,59 6,-,-,-,-,-,-,-
205 8,-,-,-,-,-,210 2,-,-,-
66 0,-,1 4,-,217 6,-,-,-,-,88 2
-,233 2,-,-,-,-,296 10,-,188 7,-
25...

output:

1633

result:

ok 1 number(s): "1633"

Test #39:

score: 0
Accepted
time: 115ms
memory: 4956kb

input:

240
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,152 10,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-...

output:

3666

result:

ok 1 number(s): "3666"

Test #40:

score: 0
Accepted
time: 150ms
memory: 5156kb

input:

240
-,-,-,-,-,-,-,-,-,51 1
-,48 5,-,-,-,-,-,44 6,-,260 0
-,-,225 0,-,-,278 8,-,-,-,-
-,-,-,-,288 8,-,-,-,-,-
-,-,-,-,-,75 1,-,-,-,-
242 1,-,-,-,-,-,-,-,216 8,-
-,-,-,-,153 1,-,249 9,-,36 9,-
-,-,-,152 2,-,-,-,105 5,-,-
-,-,-,-,-,-,252 5,-,-,-
-,-,-,-,-,272 1,-,-,107 0,-
261 6,-,-,-,-,170 1,89 6,-,-,...

output:

3700

result:

ok 1 number(s): "3700"

Test #41:

score: 0
Accepted
time: 410ms
memory: 5248kb

input:

300
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,...

output:

15400

result:

ok 1 number(s): "15400"

Test #42:

score: 0
Accepted
time: 343ms
memory: 5320kb

input:

300
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,...

output:

13800

result:

ok 1 number(s): "13800"

Test #43:

score: 0
Accepted
time: 397ms
memory: 3948kb

input:

10
33 8,-,140 3,296 2,210 3,69 1,78 6,53 0,69 0,4 1
126 2,131 0,75 2,113 2,128 4,217 0,151 4,129 8,101 5,154 8
260 5,58 9,39 4,52 1,137 3,75 6,54 4,4 4,69 9,227 10
228 1,142 10,208 1,223 9,138 0,289 4,166 1,78 1,236 7,164 3
22 4,15 6,68 1,229 10,8 0,-,211 4,156 10,214 0,297 9
34 5,52 0,103 0,-,241 0...

output:

2225

result:

ok 1 number(s): "2225"

Test #44:

score: 0
Accepted
time: 265ms
memory: 3992kb

input:

10
225 10,-,-,-,94 3,-,28 2,-,-,-
-,-,-,-,-,163 8,-,-,-,-
-,228 1,-,113 3,-,-,208 10,249 2,228 5,-
-,-,-,127 1,-,-,227 3,54 4,-,-
-,-,-,-,-,-,149 6,250 8,-,-
-,-,-,-,286 1,-,-,-,-,-
201 4,156 4,-,205 1,63 4,229 10,-,55 1,-,188 6
-,273 0,-,-,-,-,-,-,31 6,290 0
-,-,198 2,-,-,150 6,-,267 2,118 4,-
-,-,...

output:

8800

result:

ok 1 number(s): "8800"

Test #45:

score: 0
Accepted
time: 107ms
memory: 3944kb

input:

10
13 2,-,-,-,5 7,282 0,-,64 6,183 3,108 1
-,-,-,282 1,219 8,73 4,-,-,220 6,248 3
-,96 8,-,-,-,218 4,60 8,90 9,150 9,206 4
299 6,205 1,234 0,-,-,-,24 8,290 1,247 5,81 8
-,-,-,-,75 1,-,251 3,38 3,183 1,106 10
146 7,-,208 1,-,282 9,55 10,191 6,6 1,-,250 1
179 6,-,128 6,110 4,161 10,-,-,202 4,79 8,-
72...

output:

2155

result:

ok 1 number(s): "2155"

Test #46:

score: 0
Accepted
time: 138ms
memory: 3920kb

input:

10
-,26 2,-,10 8,172 1,205 7,3 0,-,-,-
23 5,-,-,-,-,-,103 6,-,-,224 6
-,142 2,-,-,-,-,-,101 6,-,203 3
-,209 10,-,-,-,-,-,240 4,-,-
-,-,-,81 5,189 6,-,100 9,-,259 2,-
-,-,-,-,-,50 0,300 0,263 7,28 9,31 2
216 10,-,-,-,-,113 9,-,205 4,-,200 5
-,255 0,146 4,-,-,-,-,-,-,-
164 0,292 10,240 10,73 7,-,-,-,-...

output:

2033

result:

ok 1 number(s): "2033"

Test #47:

score: 0
Accepted
time: 116ms
memory: 3936kb

input:

10
-,69 2,197 10,145 7,-,232 9,226 10,-,-,201 7
-,-,23 7,-,274 1,22 2,81 9,223 2,123 2,192 3
243 2,15 1,265 2,293 2,285 10,110 6,128 3,122 10,65 4,8 4
-,32 2,168 6,-,192 7,61 6,-,113 5,22 10,-
-,95 6,215 10,123 9,241 0,204 8,192 2,-,86 1,213 4
294 1,109 9,99 7,137 2,62 6,13 2,-,107 9,101 6,-
209 6,-...

output:

2100

result:

ok 1 number(s): "2100"

Test #48:

score: 0
Accepted
time: 134ms
memory: 3872kb

input:

10
81 9,51 4,-,-,56 9,43 1,-,291 5,-,-
294 5,-,-,217 9,-,-,143 9,211 4,-,-
-,-,-,-,-,170 2,-,67 0,-,-
-,134 7,-,172 8,235 7,15 1,-,-,87 2,244 1
234 9,162 4,-,-,243 6,300 9,175 0,-,30 2,-
-,191 9,299 5,-,24 8,-,156 0,236 8,164 8,206 7
-,-,4 4,-,192 2,95 10,289 2,-,-,-
266 5,-,192 1,-,254 3,-,-,-,266 ...

output:

3655

result:

ok 1 number(s): "3655"

Test #49:

score: 0
Accepted
time: 363ms
memory: 3936kb

input:

10
65 2,-,-,36 2,246 9,70 3,-,-,7 6,-
180 10,163 8,174 10,48 1,24 2,-,209 2,278 6,224 5,-
106 1,4 6,299 3,180 7,68 9,219 3,242 2,67 2,3 6,-
-,192 4,2 10,-,67 9,-,21 2,-,129 1,15 0
133 5,71 0,34 10,183 2,15 2,127 9,5 8,128 9,147 10,294 8
32 2,133 2,-,249 10,-,81 10,292 9,253 8,99 10,-
2 6,273 10,151 ...

output:

7166

result:

ok 1 number(s): "7166"

Test #50:

score: 0
Accepted
time: 113ms
memory: 3924kb

input:

10
-,-,262 0,-,145 7,-,-,-,-,269 9
-,-,-,121 7,-,-,-,-,51 7,-
-,-,254 5,41 8,-,-,-,-,-,-
240 3,-,4 6,-,-,-,-,-,176 6,-
-,-,298 3,-,-,58 4,-,-,-,-
-,-,-,-,-,-,168 6,-,-,-
-,199 6,-,-,179 2,-,-,-,-,-
-,-,-,164 8,-,-,259 6,-,-,-
-,-,-,-,-,-,-,-,-,-
-,14 10,-,-,-,-,-,72 5,-,-

output:

4066

result:

ok 1 number(s): "4066"

Test #51:

score: 0
Accepted
time: 601ms
memory: 5280kb

input:

300
10 0,20 0,30 0,40 0,50 0,60 0,70 0,80 0,90 0,100 0
10 0,20 0,30 0,40 0,50 0,60 0,70 0,80 0,90 0,100 0
10 0,20 0,30 0,40 0,50 0,60 0,70 0,80 0,90 0,100 0
10 0,20 0,30 0,40 0,50 0,60 0,70 0,80 0,90 0,100 0
10 0,20 0,30 0,40 0,50 0,60 0,70 0,80 0,90 0,100 0
10 0,20 0,30 0,40 0,50 0,60 0,70 0,80 0,9...

output:

15400

result:

ok 1 number(s): "15400"

Test #52:

score: 0
Accepted
time: 414ms
memory: 3952kb

input:

10
10 0,20 0,30 0,40 0,50 0,60 0,70 0,80 0,90 0,100 0
10 0,20 0,30 0,40 0,50 0,60 0,70 0,80 0,90 0,100 0
10 0,20 0,30 0,40 0,50 0,60 0,70 0,80 0,90 0,100 0
10 0,20 0,30 0,40 0,50 0,60 0,70 0,80 0,90 0,100 0
10 0,20 0,30 0,40 0,50 0,60 0,70 0,80 0,90 0,100 0
10 0,20 0,30 0,40 0,50 0,60 0,70 0,80 0,90...

output:

8900

result:

ok 1 number(s): "8900"

Test #53:

score: 0
Accepted
time: 447ms
memory: 3940kb

input:

10
10 0,20 0,30 0,40 0,50 0,61 0,69 0,80 0,90 0,100 0
10 0,20 0,30 0,40 0,50 0,61 0,69 0,80 0,90 0,100 0
10 0,20 0,30 0,40 0,50 0,61 0,69 0,80 0,90 0,100 0
10 0,20 0,30 0,40 0,50 0,61 0,69 0,80 0,90 0,100 0
10 0,20 0,30 0,40 0,50 0,61 0,69 0,80 0,90 0,100 0
10 0,20 0,30 0,40 0,50 0,61 0,69 0,80 0,90...

output:

8900

result:

ok 1 number(s): "8900"