Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions atcoder/ABC/WA/abc229_d/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions atcoder/ABC/WA/abc229_d/.idea/libraries/KotlinJavaRuntime.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions atcoder/ABC/WA/abc229_d/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions atcoder/ABC/WA/abc229_d/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions atcoder/ABC/WA/abc229_d/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions atcoder/ABC/WA/abc229_d/abc229_d.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
</component>
</module>
Binary file not shown.
114 changes: 114 additions & 0 deletions atcoder/ABC/WA/abc229_d/src/main.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import java.io.PrintWriter
import kotlin.math.max
import kotlin.math.min

fun next() = readLine()!!
fun nextInt() = next().toInt()

@JvmField val _writer = PrintWriter(System.out, false)
fun main() { _writer.solve(); _writer.flush() }
fun PrintWriter.solve() {
val s = next()
val k = nextInt()

val ml = mutableListOf<Int>()
for (i in s.indices) {
if (s[i] == '.') {
ml.add(i)
}
}

val num = min(ml.size, k)

val l = ml.combinationWithoutRepetition(num)

var ans = 0
for (i in l) {
var tmpS = s.toCharArray()
for (j in i) {
tmpS[j] = 'X'
}

var isFound = false
var cnt = 0
for (i in tmpS.indices) {
if (tmpS[i] == 'X') {
isFound = true
cnt++
}
else if (isFound) {
ans = max(cnt, ans)
isFound = false
cnt = 0
}
}
ans = max(cnt, ans)
}

println(ans)
}


fun next_combination() : Boolean {
val l = listOf<Int>(0,1,2)
val l2 = l.iterator()
l2.
}


//template <typename T> bool next_combination(const T first, const T last, int k) {
// const T subset = first + k;
// // empty container | k = 0 | k == n
// if (first == last || first == subset || last == subset) {
// return false;
// }
// T src = subset;
// while (first != src) {
// src--;
// if (*src < *(last - 1)) {
// T dest = subset;
// while (*src >= *dest) {
// dest++;
// }
// iter_swap(src, dest);
// rotate(src + 1, dest + 1, last);
// rotate(subset, subset + (last - dest) - 1, last);
// return true;
// }
// }
// // restore
// rotate(first, subset, last);
// return false;
//}



private fun <T> pcSequenceFactory(
selecteds: List<T> = emptyList(),
filter: (options: List<T>, i: Int) -> List<T>
): (options: List<T>, k: Int) -> Sequence<List<T>> =
{ options, k ->
sequence {
if (k == 0) {
yield(selecteds)
return@sequence
}

options.forEachIndexed { i, option ->
pcSequenceFactory(selecteds + option, filter).let {
it(filter(options, i), k - 1)
}.forEach {
yield(it)
}
}
}
}

/** 重複なしの組み合わせ */
fun <T> List<T>.combinationWithoutRepetition(k: Int): Sequence<List<T>> {
require(k in 0..size) { "引数 k は 0 以上かつ $size 以下でなければなりません。k: $k" }

return pcSequenceFactory<T> { options, i ->
options.drop(i + 1)
}(this, k)
}
3 changes: 3 additions & 0 deletions atcoder/ABC/abc229_a/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions atcoder/ABC/abc229_a/.idea/libraries/KotlinJavaRuntime.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions atcoder/ABC/abc229_a/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions atcoder/ABC/abc229_a/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions atcoder/ABC/abc229_a/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions atcoder/ABC/abc229_a/abc229_a.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
</component>
</module>
16 changes: 16 additions & 0 deletions atcoder/ABC/abc229_a/src/main.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import java.io.PrintWriter
fun next() = readLine()!!

@JvmField val _writer = PrintWriter(System.out, false)
fun main() { _writer.solve(); _writer.flush() }
fun PrintWriter.solve() {
val s1 = next()
val s2 = next()

var ans = true
if ((s1 == "#." && s2 == ".#") || (s1 == ".#" && s2 == "#.")) {
ans = false
}

println(if (ans) "Yes" else "No")
}
3 changes: 3 additions & 0 deletions atcoder/ABC/abc229_b/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions atcoder/ABC/abc229_b/.idea/libraries/KotlinJavaRuntime.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions atcoder/ABC/abc229_b/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions atcoder/ABC/abc229_b/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions atcoder/ABC/abc229_b/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions atcoder/ABC/abc229_b/abc229_b.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
</component>
</module>
Binary file not shown.
25 changes: 25 additions & 0 deletions atcoder/ABC/abc229_b/src/main.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import java.io.PrintWriter
fun next() = readLine()!!
fun nextLongList() = next().split(" ").map{ it.toLong() }

@JvmField val _writer = PrintWriter(System.out, false)
fun main() { _writer.solve(); _writer.flush() }
fun PrintWriter.solve() {
var (a, b) = nextLongList()

var ans = true
while(a != 0L && b != 0L) {
val tmpA = a % 10L
val tmpB = b % 10L

if (tmpA + tmpB >= 10L) {
ans = false
break
}

a /= 10L
b /= 10L
}

println(if (ans) "Easy" else "Hard")
}
3 changes: 3 additions & 0 deletions atcoder/ABC/abc229_c/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions atcoder/ABC/abc229_c/.idea/libraries/KotlinJavaRuntime.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions atcoder/ABC/abc229_c/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions atcoder/ABC/abc229_c/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions atcoder/ABC/abc229_c/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading