Submission #719710


Source Code Expand

import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {
    FastScanner fs = new FastScanner();

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        int N = 0;
        int Q = 0;
        int L = 0;
        int R = 0;
        int T = 0;
        N = fs.nextInt();
        Q = fs.nextInt();
        int[] a = new int[N];
        Arrays.fill(a , 0);
        for(int i = 0; i < Q; i++) {
            L = fs.nextInt() - 1;
            R = fs.nextInt() - 1;
            T = fs.nextInt();
            Arrays.fill(a, L, R + 1 , T);
        }
        for(int i = 0; i < N; i++) {
            System.out.println(a[i]);
        }
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte()) return buffer[ptr++];
        else return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    private void skipUnprintable() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
    }

    public boolean hasNext() {
        skipUnprintable();
        return hasNextByte();
    }

    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        if (!hasNext()) throw new NoSuchElementException();
        int n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
}

Submission Info

Submission Time
Task B - 編集
User moomin
Language Java8 (OpenJDK 1.8.0)
Score 100
Code Size 3569 Byte
Status AC
Exec Time 158 ms
Memory 8148 KiB

Judge Result

Set Name sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 2
AC × 22
Set Name Test Cases
sample sample01.txt, sample02.txt
All 00.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, sample01.txt, sample02.txt
Case Name Status Exec Time Memory
00.txt AC 149 ms 7892 KiB
01.txt AC 147 ms 7892 KiB
02.txt AC 153 ms 7892 KiB
03.txt AC 149 ms 7892 KiB
04.txt AC 145 ms 7892 KiB
05.txt AC 153 ms 8020 KiB
06.txt AC 149 ms 7892 KiB
07.txt AC 149 ms 7764 KiB
08.txt AC 148 ms 8020 KiB
09.txt AC 157 ms 7892 KiB
10.txt AC 153 ms 8016 KiB
11.txt AC 154 ms 8020 KiB
12.txt AC 157 ms 8020 KiB
13.txt AC 152 ms 8020 KiB
14.txt AC 154 ms 8020 KiB
15.txt AC 153 ms 8016 KiB
16.txt AC 156 ms 7892 KiB
17.txt AC 157 ms 8016 KiB
18.txt AC 158 ms 8148 KiB
19.txt AC 154 ms 7892 KiB
sample01.txt AC 157 ms 7764 KiB
sample02.txt AC 151 ms 7760 KiB