| Task: | Urkupillit |
| Sender: | MusserO |
| Submission time: | 2015-01-29 12:51:16 +0200 |
| Language: | Java |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| #2 | WRONG ANSWER | 0 |
| #3 | RUNTIME ERROR | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.03 s | 1 | details |
| #2 | ACCEPTED | 0.02 s | 1 | details |
| #3 | WRONG ANSWER | 0.02 s | 1 | details |
| #4 | WRONG ANSWER | 0.05 s | 1 | details |
| #5 | WRONG ANSWER | 0.05 s | 1 | details |
| #6 | ACCEPTED | 0.04 s | 2 | details |
| #7 | ACCEPTED | 0.04 s | 2 | details |
| #8 | WRONG ANSWER | 0.03 s | 2 | details |
| #9 | WRONG ANSWER | 0.03 s | 2 | details |
| #10 | WRONG ANSWER | 0.02 s | 2 | details |
| #11 | ACCEPTED | 0.61 s | 3 | details |
| #12 | RUNTIME ERROR | 0.02 s | 3 | details |
| #13 | RUNTIME ERROR | 0.04 s | 3 | details |
| #14 | RUNTIME ERROR | 0.03 s | 3 | details |
| #15 | WRONG ANSWER | 0.58 s | 3 | details |
Code
import java.io.*;
import java.util.*;
public class Urkupillit {
public static void main(String[] args) {
IO io = new IO();
int n = io.nextInt();
int k = io.nextInt();
int j = 0;
for (int i = 0; i < n; ++i){
if (j < k){
io.print(n-i+" ");
++j;
} else {
io.print(i-j+1+" ");
}
}
io.close();
}
}
class IO extends PrintWriter {
private InputStreamReader r;
private static final int BUFSIZE = 1 << 15;
private char[] buf;
private int bufc;
private int bufi;
private StringBuilder sb;
public IO() {
super(new BufferedOutputStream(System.out));
r = new InputStreamReader(System.in);
buf = new char[BUFSIZE];
bufc = 0;
bufi = 0;
sb = new StringBuilder();
}
private void fillBuf() throws IOException {
bufi = 0;
bufc = 0;
while(bufc == 0) {
bufc = r.read(buf, 0, BUFSIZE);
if(bufc == -1) {
bufc = 0;
return;
}
}
}
private boolean pumpBuf() throws IOException {
if(bufi == bufc) {
fillBuf();
}
return bufc != 0;
}
private boolean isDelimiter(char c) {
return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f';
}
private void eatDelimiters() throws IOException {
while(true) {
if(bufi == bufc) {
fillBuf();
if(bufc == 0) throw new RuntimeException("IO: Out of input.");
}
if(!isDelimiter(buf[bufi])) break;
++bufi;
}
}
public String next() {
try {
sb.setLength(0);
eatDelimiters();
int start = bufi;
while(true) {
if(bufi == bufc) {
sb.append(buf, start, bufi - start);
fillBuf();
start = 0;
if(bufc == 0) break;
}
if(isDelimiter(buf[bufi])) break;
++bufi;
}
sb.append(buf, start, bufi - start);
return sb.toString();
} catch(IOException e) {
throw new RuntimeException("IO.next: Caught IOException.");
}
}
public int nextInt() {
try {
int ret = 0;
eatDelimiters();
boolean positive = true;
if(buf[bufi] == '-') {
++bufi;
if(!pumpBuf()) throw new RuntimeException("IO.nextInt: Invalid int.");
positive = false;
}
boolean first = true;
while(true) {
if(!pumpBuf()) break;
if(isDelimiter(buf[bufi])) {
if(first) throw new RuntimeException("IO.nextInt: Invalid int.");
break;
}
first = false;
if(buf[bufi] >= '0' && buf[bufi] <= '9') {
if(ret < -214748364) throw new RuntimeException("IO.nextInt: Invalid int.");
ret *= 10;
ret -= (int)(buf[bufi] - '0');
if(ret > 0) throw new RuntimeException("IO.nextInt: Invalid int.");
} else {
throw new RuntimeException("IO.nextInt: Invalid int.");
}
++bufi;
}
if(positive) {
if(ret == -2147483648) throw new RuntimeException("IO.nextInt: Invalid int.");
ret = -ret;
}
return ret;
} catch(IOException e) {
throw new RuntimeException("IO.nextInt: Caught IOException.");
}
}
public long nextLong() {
try {
long ret = 0;
eatDelimiters();
boolean positive = true;
if(buf[bufi] == '-') {
++bufi;
if(!pumpBuf()) throw new RuntimeException("IO.nextLong: Invalid long.");
positive = false;
}
boolean first = true;
while(true) {
if(!pumpBuf()) break;
if(isDelimiter(buf[bufi])) {
if(first) throw new RuntimeException("IO.nextLong: Invalid long.");
break;
}
first = false;
if(buf[bufi] >= '0' && buf[bufi] <= '9') {
if(ret < -922337203685477580L) throw new RuntimeException("IO.nextLong: Invalid long.");
ret *= 10;
ret -= (long)(buf[bufi] - '0');
if(ret > 0) throw new RuntimeException("IO.nextLong: Invalid long.");
} else {
throw new RuntimeException("IO.nextLong: Invalid long.");
}
++bufi;
}
if(positive) {
if(ret == -9223372036854775808L) throw new RuntimeException("IO.nextLong: Invalid long.");
ret = -ret;
}
return ret;
} catch(IOException e) {
throw new RuntimeException("IO.nextLong: Caught IOException.");
}
}
public double nextDouble() {
return Double.parseDouble(next());
}
}
Test details
Test 1
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 5 0 |
| correct output |
|---|
| 1 2 3 4 5 |
| user output |
|---|
| 1 2 3 4 5 |
Test 2
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 5 10 |
| correct output |
|---|
| 5 4 3 2 1 |
| user output |
|---|
| 5 4 3 2 1 |
Test 3
Group: 1
Verdict: WRONG ANSWER
| input |
|---|
| 5 3 |
| correct output |
|---|
| 4 1 2 3 5 |
| user output |
|---|
| 5 4 3 1 2 |
Test 4
Group: 1
Verdict: WRONG ANSWER
| input |
|---|
| 5 1 |
| correct output |
|---|
| 2 1 3 4 5 |
| user output |
|---|
| 5 1 2 3 4 |
Test 5
Group: 1
Verdict: WRONG ANSWER
| input |
|---|
| 5 2 |
| correct output |
|---|
| 3 1 2 4 5 |
| user output |
|---|
| 5 4 1 2 3 |
Test 6
Group: 2
Verdict: ACCEPTED
| input |
|---|
| 100 0 |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
Test 7
Group: 2
Verdict: ACCEPTED
| input |
|---|
| 100 4950 |
| correct output |
|---|
| 100 99 98 97 96 95 94 93 92 91... |
| user output |
|---|
| 100 99 98 97 96 95 94 93 92 91... |
Test 8
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 100 2279 |
| correct output |
|---|
| 100 99 98 97 96 95 94 93 92 91... |
| user output |
|---|
| 100 99 98 97 96 95 94 93 92 91... |
Test 9
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 100 2528 |
| correct output |
|---|
| 100 99 98 97 96 95 94 93 92 91... |
| user output |
|---|
| 100 99 98 97 96 95 94 93 92 91... |
Test 10
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 100 4483 |
| correct output |
|---|
| 100 99 98 97 96 95 94 93 92 91... |
| user output |
|---|
| 100 99 98 97 96 95 94 93 92 91... |
Test 11
Group: 3
Verdict: ACCEPTED
| input |
|---|
| 100000 0 |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
Test 12
Group: 3
Verdict: RUNTIME ERROR
| input |
|---|
| 100000 4999950000 |
| correct output |
|---|
| 100000 99999 99998 99997 99996... |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.lang.RuntimeException: IO.nextInt: Invalid int. at IO.nextInt(Urkupillit.java:127) at Urkupillit.main(Urkupillit.java:8)
Test 13
Group: 3
Verdict: RUNTIME ERROR
| input |
|---|
| 100000 2969035543 |
| correct output |
|---|
| 100000 99999 99998 99997 99996... |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.lang.RuntimeException: IO.nextInt: Invalid int. at IO.nextInt(Urkupillit.java:127) at Urkupillit.main(Urkupillit.java:8)
Test 14
Group: 3
Verdict: RUNTIME ERROR
| input |
|---|
| 100000 2495939870 |
| correct output |
|---|
| 100000 99999 99998 99997 99996... |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.lang.RuntimeException: IO.nextInt: Invalid int. at IO.nextInt(Urkupillit.java:127) at Urkupillit.main(Urkupillit.java:8)
Test 15
Group: 3
Verdict: WRONG ANSWER
| input |
|---|
| 100000 1279770330 |
| correct output |
|---|
| 100000 99999 99998 99997 99996... |
| user output |
|---|
| 100000 99999 99998 99997 99996... |
