Submission #42947


Source Code Expand

import java.util.Scanner;

public class Main {
	static boolean[] tv;
	static boolean[] newTv;
	static int len;

	public static void main(String[] args) {
		doIt();
	}
	
	static void doIt(){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		len = s.length();
		tv = new boolean[len];
		newTv =  new boolean[len];
		int c = 0, ans = 1;
		for(int i = 0; i < len; i++){
			if(s.charAt(i) == 'o') tv[i] = newTv[i] = true;
			else {tv[i] = newTv[i]  = false; c++;}
		}
		while(c > 0){
			int max = 0;
			int maxz = 0;
			for(int i = 1; i < len; i++){
				int t = check(i);
				if(t > max){
					max = t;
					maxz = i;
				}
			}
			//更新
			update(maxz);
			c -= max;
			ans++;
		}
		System.out.println(ans);
	}
	
	static int check(int z){
		int ret = 0;
		for(int i = 0; i < len; i++){
			if(newTv[i] == false && tv[(i + z) % len] == true) ret++;
		}
		return ret;
	}
	static void update(int z){
		for(int i = 0; i < len; i++) newTv[i] = newTv[i] | tv[(i + z) % len];
	}

}

Submission Info

Submission Time
Task C - 節約生活
User mkiken
Language Java (OpenJDK 1.7.0)
Score 0
Code Size 1040 Byte
Status WA
Exec Time 472 ms
Memory 20248 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 52
WA × 1
Set Name Test Cases
All 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, 00_sample_05.txt, 01_rand_00.txt, 01_rand_01.txt, 01_rand_02.txt, 01_rand_03.txt, 01_rand_04.txt, 01_rand_05.txt, 01_rand_06.txt, 01_rand_07.txt, 01_rand_08.txt, 01_rand_09.txt, 01_rand_10.txt, 01_rand_11.txt, 01_rand_12.txt, 01_rand_13.txt, 01_rand_14.txt, 01_rand_15.txt, 01_rand_16.txt, 01_rand_17.txt, 01_rand_18.txt, 01_rand_19.txt, 02_maxrand_00.txt, 02_maxrand_01.txt, 02_maxrand_02.txt, 02_maxrand_03.txt, 02_maxrand_04.txt, 02_maxrand_05.txt, 02_maxrand_06.txt, 02_maxrand_07.txt, 02_maxrand_08.txt, 02_maxrand_09.txt, 02_maxrand_10.txt, 02_maxrand_11.txt, 02_maxrand_12.txt, 02_maxrand_13.txt, 02_maxrand_14.txt, 02_maxrand_15.txt, 02_maxrand_16.txt, 02_maxrand_17.txt, 02_maxrand_18.txt, 02_maxrand_19.txt, 03_max.txt, 03_maxret.txt, 03_min.txt, 03_special_01.txt, 03_special_02.txt, 03_special_03.txt, 03_special_04.txt, 04_special_05.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 435 ms 20244 KB
00_sample_02.txt AC 419 ms 20112 KB
00_sample_03.txt AC 420 ms 20116 KB
00_sample_04.txt AC 418 ms 20100 KB
00_sample_05.txt AC 425 ms 20108 KB
01_rand_00.txt AC 437 ms 20104 KB
01_rand_01.txt AC 434 ms 20232 KB
01_rand_02.txt AC 433 ms 20236 KB
01_rand_03.txt AC 442 ms 20124 KB
01_rand_04.txt AC 434 ms 20096 KB
01_rand_05.txt AC 434 ms 20100 KB
01_rand_06.txt AC 430 ms 20120 KB
01_rand_07.txt AC 427 ms 20100 KB
01_rand_08.txt AC 445 ms 20236 KB
01_rand_09.txt AC 464 ms 20208 KB
01_rand_10.txt AC 446 ms 20228 KB
01_rand_11.txt AC 456 ms 20228 KB
01_rand_12.txt AC 459 ms 20116 KB
01_rand_13.txt AC 437 ms 20116 KB
01_rand_14.txt AC 453 ms 20244 KB
01_rand_15.txt AC 432 ms 20228 KB
01_rand_16.txt AC 439 ms 20236 KB
01_rand_17.txt AC 447 ms 20196 KB
01_rand_18.txt AC 444 ms 20116 KB
01_rand_19.txt AC 436 ms 20228 KB
02_maxrand_00.txt AC 439 ms 20248 KB
02_maxrand_01.txt AC 454 ms 20232 KB
02_maxrand_02.txt AC 435 ms 20240 KB
02_maxrand_03.txt AC 466 ms 20232 KB
02_maxrand_04.txt WA 429 ms 20244 KB
02_maxrand_05.txt AC 450 ms 20152 KB
02_maxrand_06.txt AC 431 ms 20112 KB
02_maxrand_07.txt AC 462 ms 20228 KB
02_maxrand_08.txt AC 433 ms 20228 KB
02_maxrand_09.txt AC 451 ms 20244 KB
02_maxrand_10.txt AC 434 ms 20236 KB
02_maxrand_11.txt AC 431 ms 20228 KB
02_maxrand_12.txt AC 419 ms 20236 KB
02_maxrand_13.txt AC 449 ms 20236 KB
02_maxrand_14.txt AC 415 ms 20104 KB
02_maxrand_15.txt AC 442 ms 20104 KB
02_maxrand_16.txt AC 422 ms 20116 KB
02_maxrand_17.txt AC 472 ms 20216 KB
02_maxrand_18.txt AC 414 ms 20232 KB
02_maxrand_19.txt AC 418 ms 20240 KB
03_max.txt AC 422 ms 20204 KB
03_maxret.txt AC 449 ms 20204 KB
03_min.txt AC 426 ms 20236 KB
03_special_01.txt AC 441 ms 20192 KB
03_special_02.txt AC 420 ms 20100 KB
03_special_03.txt AC 455 ms 20236 KB
03_special_04.txt AC 430 ms 20220 KB
04_special_05.txt AC 442 ms 20100 KB