https://kotlinlang.org logo
Join SlackCommunities
Powered by
# codeforces
  • a

    amadeu01

    05/28/2019, 5:17 PM
    [Thread] H
    • 1
    • 4
  • a

    amadeu01

    05/28/2019, 5:17 PM
    [Thread] I
    • 1
    • 1
  • e

    elizarov

    05/28/2019, 5:33 PM
    🎉 Thanks everybody for participating! It was a great competition. Please, use Slack threads for problem discussions. Author’s editorials will be soon published on codeforces. Note that they are quite technical for more complex problem (it is Ok if you don’t understand them — it takes practice). I’ll do a separate write up on easier problems.
    K 5
    ❤️ 10
    a
    • 2
    • 2
  • s

    stkent

    05/28/2019, 5:34 PM
    Thank you for organizing! I hope there are more so I can do better in the future 😄
  • m

    matiaslev

    05/29/2019, 8:39 PM
    yes thanks 🤣 I didn't go well but I learned and enjoyed a lot.
  • a

    amadeu01

    05/31/2019, 5:13 PM
    I guess the thread only notify who is watching it, so if anyone is willing to show the solution for H, I would like to see 😄
  • b

    bezrukov

    05/31/2019, 5:18 PM
    You can watch winner's solutions 🙂
    a
    • 2
    • 2
  • a

    amadeu01

    06/01/2019, 2:57 AM
    Anyone wants to debate about Longest Saw ?
    e
    • 2
    • 7
  • s

    Sam

    09/01/2019, 12:36 PM
    Anyone have some suggestion for
    D. Divide by three, multiply by two
    ?
    b
    • 2
    • 1
  • s

    Sam

    09/01/2019, 12:37 PM
    I have spent 2 days for this problem, but still can not pass the test LOL
  • e

    elizarov

    09/07/2019, 7:59 AM
    🎉 Kotlin Heroes Episode 2 is today! http://codeforces.com/blog/entry/69419
  • a

    amadeu01

    09/07/2019, 7:28 PM
    Hi folks, how do we know who got the T-shirt?
    b
    • 2
    • 3
  • a

    amadeu01

    09/07/2019, 8:26 PM
    @elizarov do we get any email regarding the shipment of the shirt ? I didn’t know about the address on the codeforces I just updated the with my address.
    e
    • 2
    • 2
  • a

    amadeu01

    09/09/2019, 6:46 PM
    @elizarov I heard about the kotlin heroes only one day before the contest, do you have any calendar about the next episodes just to not miss 😄
    e
    • 2
    • 1
  • e

    elizarov

    02/13/2020, 11:20 AM
    Here you go: https://blog.jetbrains.com/kotlin/2020/02/kotlin-heroes-3-a-programming-challenge-from-jetbrains-and-codeforces/
    b
    a
    • 3
    • 5
  • e

    elizarov

    02/27/2020, 7:35 AM
    📣 Kotlin Heroes: Episode 3 starts today at 13:35 UTC.
  • e

    elizarov

    02/27/2020, 4:08 PM
    ☝️ It's over. Time to share your experience. How was it? 🧵
    m
    p
    • 3
    • 4
  • e

    elizarov

    03/04/2020, 8:07 PM
    https://blog.jetbrains.com/blog/2020/03/04/edutools-plugin-v3-4-released
    ❤️ 2
    👏 7
  • c

    Chills

    03/30/2020, 12:42 PM
    thanks for the channel
  • e

    elizarov

    05/18/2020, 12:26 PM
    📣 https://blog.jetbrains.com/kotlin/2020/05/kotlin-heroes-4-the-next-round-is-almost-here/
    👍 6
  • p

    Pere Casafont

    05/23/2020, 9:51 AM
    I'm trying out the latest EduTools Plugin + CodeForces and when I run the local tests it says no output. What am I doing wrong?
    ➕ 1
    a
    m
    l
    • 4
    • 6
  • s

    Slackbot

    05/29/2020, 4:52 PM
    This message was deleted.
    m
    c
    b
    • 4
    • 9
  • d

    dan

    07/18/2020, 12:46 PM
    Anybody knows when is the next Kotlin Heroes contest (#5)
    e
    • 2
    • 1
  • b

    blue

    08/07/2020, 1:27 PM
    Copy code
    package seamcarving
    import java.awt.Color
    import java.awt.Graphics2D
    import java.awt.image.BufferedImage
    import java.io.File
    import javax.imageio.ImageIO
    import kotlin.math.pow
    import kotlin.math.sqrt
    fun main(args: Array<String>) {
        val bufferedImage = ImageIO.read(File("/Users/name/Downloads/images/blue.png"))
        val outImage = ImageIO.read(File("/Users/name/Downloads/images/blue.png"))
        val height = bufferedImage.height
        val width = bufferedImage.width
        var minX = 0
    //    (minSeamX, 0) would be the coordinate of the minimum seam
        var minSeamX = 0
        var minSeam = Double.MAX_VALUE
        //Starting from top left find the sum of pixel energies for all possible seams(#width number of possible seams) 
        for (column in 0 until width) {
            var totalSeam = 0.0
            var xHigh = column
            var xLow = column
            var min = Double.MAX_VALUE
            for (y in 0 until height) {
                for (x in xLow..xHigh) {
                    if (x < 0 || x > width - 1) continue
                    val energy = calculateEnergy(x, y, bufferedImage)
    //                println("Energy $x $y $energy")
                    if (energy < min) {
                        min = energy
                        minX = x
                    }
                }
                totalSeam += min
                min = Double.MAX_VALUE
                xLow = minX - 1
                xHigh = minX + 1
            }
            if (totalSeam < minSeam) {
                minSeamX = column
                minSeam = totalSeam
            }
            println("total:$totalSeam")
        }
        var xLow = minSeamX
        var xHigh = minSeamX
        var min = Double.MAX_VALUE
        for (y in 0 until height) {
            for (x in xLow..xHigh) {
                val energy = calculateEnergy(x, y, bufferedImage)
                if (energy < min) {
                    min = energy
                    minX = x
                }
            }
            val createGraphics = applyColor(outImage, minX, y)
            min = Double.MAX_VALUE
            xLow = minX - 1
            xHigh = minX + 1
        }
    //    for (x in 0 until width) {
    //        for (y in 0 until height) {
    //            val intensity = ((255.0 * array[x][y]) / max).toInt()
    //            val color = Color(intensity, intensity, intensity)
    ////            outputImage.setRGB(x, y, intensity)
    //            createGraphics.paint = color
    //            createGraphics.fillRect(x, y, 1, 1)
    //        }
    //    }
        ImageIO.write(outImage, "png", File("out.png"))
    //    ImageIO.write(bufferedImage, "png", File("${args[3]}"))
    }
    private fun applyColor(outputImage: BufferedImage, maxX: Int, maxY: Int): Graphics2D? {
        val createGraphics = outputImage.createGraphics()
        val color = Color(255, 0, 0)
        createGraphics.paint = color
        createGraphics.fillRect(maxX, maxY, 1, 1)
        return createGraphics
    }
    private fun calculateEnergy(x: Int, y: Int, bufferedImage: BufferedImage): Double {
        return sqrt(getXGradient(x, y, bufferedImage) + getYGradient(x, y, bufferedImage))
    }
    fun getXGradient(x: Int, y: Int, inImage: BufferedImage): Double {
        val width = inImage.width
        var xx = x
        var yy = y
        if (x == 0) xx = 1
        if (x == width - 1) xx = x - 1
        val lc = Color(inImage.getRGB(xx - 1, yy))
        val rc = Color(inImage.getRGB(xx + 1, yy))
        return (lc.red - rc.red).toDouble().pow(2.0) + (lc.green - rc.green).toDouble().pow(2.0) + (lc.blue - rc.blue).toDouble().pow(2.0)
    }
    fun getYGradient(x: Int, y: Int, inImage: BufferedImage): Double {
        val height = inImage.height
        var xx = x
        var yy = y
        if (y == 0) yy = 1
        if (y == height - 1) yy = y - 1
        val lc = Color(inImage.getRGB(xx, yy - 1))
        val rc = Color(inImage.getRGB(xx, yy + 1))
        return (lc.red - rc.red).toDouble().pow(2.0) + (lc.green - rc.green).toDouble().pow(2.0) + (lc.blue - rc.blue).toDouble().pow(2.0)
    }
  • b

    blue

    08/07/2020, 1:27 PM
    Hi Everyone, I am working on a seam carving exercise from Hyperskill, looking for some help. Can someone tell me what am I doing wrong here. I am pretty sure I did not understand the project statement correctly. (I’ve been fighting it for a week) Project: https://hyperskill.org/projects/100/stages/553/implement
    s
    • 2
    • 1
  • l

    Light Yagami

    11/07/2020, 12:18 PM
    Is there a way to add ur own template in edutools plugin for codeforces contests?
  • p

    Paul SOUTEYRAT

    05/02/2022, 9:57 AM
    Anyone has the same issue https://github.com/JetBrains/educational-plugin/issues/31 ?
  • a

    Abidin Burak Şahin

    04/02/2024, 11:51 AM
    Hello everyone, I'm studying to learn kotlin therefore i created a github repo and I'm writing code for codeforces problems everyday. Can you give me some feedback for contribute to me? https://github.com/abidinburak/Codeforces-Soulitons-Kotlin #100daysofkotlin #competitive-programming #codeforces
  • a

    Abidin Burak Şahin

    05/21/2024, 10:28 AM
    Hello, You know, I started an adventure about solving Codeforces problems for 100 days. Today I'm on day 91 and I'm getting closer to the end. If you want to check it out, you can reach my github repo via the link. https://github.com/abidinburak/Codeforces-Solutions-Kotlin
  • a

    Angel lee

    09/16/2024, 10:25 AM
    How do you guys setup environment on Jetbrains to participate in CodeForce?