Submission #132507


Source Code Expand

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.Scanner;
public class Main {	
//	Scanner in = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){		
//		new problem_B();
		new Atcoder_C();
	}
	
	class Atcoder_A{
		public Atcoder_A() {
			java.util.Scanner in = new java.util.Scanner(System.in);
			int n = in.nextInt();
			System.out.println(n*2);
		}
	}
	
	class Atcoder_B{
		public Atcoder_B() {
			java.util.Scanner in = new java.util.Scanner(System.in);
			String[] input = new String[4];
			for(int i=0;i<4;i++)input[i]=in.nextLine();
			for(int i=3;i>=0;i--){
				StringBuffer a = new StringBuffer(input[i]);
				System.out.println(a.reverse().toString());
			}
		}
	}
	
	class Atcoder_C{
		public Atcoder_C() {
			java.util.Scanner in = new Scanner(System.in);
			int n = in.nextInt();
//			int[] card = {-1,1,2,3,4,5,6};
			LinkedList<Integer> list = new LinkedList<Integer>();
			for(int i=1;i<=6;i++)list.add(i);
			int num = n/5;//何個後ろに行くべきか。
			int zure = n%5;
			for(int i=0;i<num;i++)list.add(list.remove());
			list.add(zure,list.remove());
//			System.out.println(list);
			for(int i=0;i<list.size();i++)System.out.print(list.get(i));
//			for(int s=0;s<n;s++){
//				int a = (s%5)+1;
//				int b = (s%5)+2;
//				int memo = card[a];
//				card[a] = card[b];
//				card[b] = memo;
//			}
//			for(int i=1;i<=6;i++)System.out.print(card[i]);
		}
	}
	
	class Atcoder_D{
		public Atcoder_D() {
			java.util.Scanner in = new Scanner(System.in);
			int r = in.nextInt();
			int g = in.nextInt();
			int b = in.nextInt();  // 1 <= rgb <= 300
			
			
			
			
			
		}
		
		
		
		
		
	}
	
	class problem_B{
		public problem_B() {
			Scanner in = new Scanner(System.in);
			int n = in.nextInt();
			LinkedList<Integer> list = new LinkedList<Integer>();
			LinkedList<Integer> list2 = new LinkedList<Integer>();
			for(int i=0;i<n;i++){
				int input = in.nextInt();
				if(!list.contains(input))list.add(input);
				else if(!list2.contains(input))list2.push(input);
			}
			Collections.sort(list);Collections.sort(list2);
			if(list2.size()>0&&list.get(list.size()-1)==list2.get(list2.size()-1))list2.remove(list2.size()-1);
			
			//print
			System.out.println(list.size()+list2.size());
			for(int i=0;i<list.size()-1;i++)System.out.print(list.get(i)+" ");
			System.out.print(list.get(list.size()-1));
			if(list2.size()>0){
				System.out.print(" ");
				for(int i=list2.size()-1;i>0;i--)System.out.print(list2.get(i)+" ");
				System.out.print(list2.get(0));
			}
			System.out.println();
		}

	    class Scanner {
	         InputStream in;
	         byte[] buf = new byte[1 << 10];
	         int p, n;
	         boolean[] isSpace = new boolean[128];
	         Scanner(InputStream in) {
	              this.in = in;
	              isSpace[' '] = isSpace['\n'] = isSpace['\r'] = isSpace['\t'] = true;
	         }
	         int read() {
	              if (n == -1) return -1;
	              if (p >= n) {
	                   p = 0;
	                   try {
	                        n = in.read(buf);
	                   } catch (IOException e) {
	                        throw new RuntimeException(e);
	                   }
	                   if (n <= 0) return -1;
	              }
	              return buf[p++];
	         }
	         boolean hasNext() {
	              int c = read();
	              while (c >= 0 && isSpace[c]) c = read();
	              if (c == -1) return false;
	              p--;
	              return true;
	         }
	         String next() {
	              if (!hasNext()) throw new InputMismatchException();
	              StringBuilder sb = new StringBuilder();
	              int c = read();
	              while (c >= 0 && !isSpace[c]) {
	                   sb.append((char)c);
	                   c = read();
	              }
	              return sb.toString();
	         }
	         int nextInt() {
	              if (!hasNext()) throw new InputMismatchException();
	              int c = read();
	              int sgn = 1;
	              if (c == '-') {
	                   sgn = -1;
	                   c = read();
	              }
	              int res = 0;
	              do {
	                   if (c < '0' || c > '9') throw new InputMismatchException();
	                   res *= 10;
	                   res += c - '0';
	                   c = read();
	              } while (c >= 0 && !isSpace[c]);
	              return res * sgn;
	         }
	         long nextLong() {
	              if (!hasNext()) throw new InputMismatchException();
	              int c = read();
	              int sgn = 1;
	              if (c == '-') {
	                   sgn = -1;
	                   c = read();
	              }
	              long res = 0;
	              do {
	                   if (c < '0' || c > '9') throw new InputMismatchException();
	                   res *= 10;
	                   res += c - '0';
	                   c = read();
	              } while (c >= 0 && !isSpace[c]);
	              return res * sgn;
	         }
	         double nextDouble() {
	              return Double.parseDouble(next());
	         }
	    }
	}
	
	

//	class problem_A{
//		public problem_A() {
//			int n = in.nextInt();
//			ArrayList<Integer> list = new ArrayList<Integer>();
//			for(int i=0;i<n;i++)list.add(in.nextInt());
//			int sereja=0,dima=0,num=0;
//			for(int i=0;list.size()>0;i++){
//				if(list.get(0)>list.get(list.size()-1))num=list.remove(0);
//				else num=list.remove(list.size()-1);
//				if(i%2==0)sereja+=num;
//				else dima+=num;
//			}
//			System.out.println(sereja+" "+dima);
//		}
//	}

}

Submission Info

Submission Time
Task C - 入れ替え
User ne240214
Language Java (OpenJDK 1.7.0)
Score 30
Code Size 5988 Byte
Status TLE
Exec Time 2046 ms
Memory 31876 KB

Judge Result

Set Name Subtask1 Subtask2
Score / Max Score 30 / 30 0 / 70
Status
AC × 13
AC × 9
TLE × 18
Set Name Test Cases
Subtask1 SubTask1/00_sample_00.txt, SubTask1/00_sample_01.txt, SubTask1/00_sample_02.txt, SubTask1/rand_19.txt, SubTask1/rand_2.txt, SubTask1/rand_25.txt, SubTask1/rand_27.txt, SubTask1/rand_33.txt, SubTask1/rand_35.txt, SubTask1/rand_4.txt, SubTask1/rand_44.txt, SubTask1/rand_48.txt, SubTask1/rand_8.txt
Subtask2 SubTask2/00_sample_03.txt, SubTask2/max_case.txt, SubTask2/rand_120009641.txt, SubTask2/rand_134230520.txt, SubTask2/rand_136939465.txt, SubTask2/rand_200732473.txt, SubTask2/rand_211796835.txt, SubTask2/rand_312330341.txt, SubTask2/rand_377341731.txt, SubTask2/rand_384611280.txt, SubTask2/rand_386098102.txt, SubTask2/rand_399010727.txt, SubTask2/rand_409627453.txt, SubTask2/rand_416537730.txt, SubTask2/rand_425486442.txt, SubTask2/rand_493135174.txt, SubTask2/rand_573105326.txt, SubTask2/rand_62794810.txt, SubTask2/rand_649471654.txt, SubTask2/rand_693017484.txt, SubTask2/rand_729197057.txt, SubTask2/rand_759630883.txt, SubTask2/rand_823752210.txt, SubTask2/rand_830399384.txt, SubTask2/rand_893242387.txt, SubTask2/rand_935005824.txt, SubTask2/rand_989703310.txt
Case Name Status Exec Time Memory
SubTask1/00_sample_00.txt AC 499 ms 23372 KB
SubTask1/00_sample_01.txt AC 485 ms 23392 KB
SubTask1/00_sample_02.txt AC 480 ms 23384 KB
SubTask1/rand_19.txt AC 472 ms 23260 KB
SubTask1/rand_2.txt AC 510 ms 23392 KB
SubTask1/rand_25.txt AC 479 ms 23388 KB
SubTask1/rand_27.txt AC 479 ms 23388 KB
SubTask1/rand_33.txt AC 482 ms 23204 KB
SubTask1/rand_35.txt AC 491 ms 23344 KB
SubTask1/rand_4.txt AC 492 ms 23384 KB
SubTask1/rand_44.txt AC 482 ms 23260 KB
SubTask1/rand_48.txt AC 491 ms 23268 KB
SubTask1/rand_8.txt AC 502 ms 23268 KB
SubTask2/00_sample_03.txt AC 969 ms 31584 KB
SubTask2/max_case.txt TLE 2041 ms 31812 KB
SubTask2/rand_120009641.txt AC 1036 ms 31580 KB
SubTask2/rand_134230520.txt AC 1100 ms 31584 KB
SubTask2/rand_136939465.txt AC 1091 ms 31580 KB
SubTask2/rand_200732473.txt AC 1313 ms 31504 KB
SubTask2/rand_211796835.txt AC 1454 ms 31588 KB
SubTask2/rand_312330341.txt AC 1825 ms 31588 KB
SubTask2/rand_377341731.txt TLE 2040 ms 31800 KB
SubTask2/rand_384611280.txt TLE 2042 ms 31788 KB
SubTask2/rand_386098102.txt AC 1990 ms 31572 KB
SubTask2/rand_399010727.txt TLE 2040 ms 31668 KB
SubTask2/rand_409627453.txt TLE 2042 ms 31772 KB
SubTask2/rand_416537730.txt TLE 2043 ms 31800 KB
SubTask2/rand_425486442.txt TLE 2043 ms 31792 KB
SubTask2/rand_493135174.txt TLE 2042 ms 31800 KB
SubTask2/rand_573105326.txt TLE 2046 ms 31668 KB
SubTask2/rand_62794810.txt AC 807 ms 31584 KB
SubTask2/rand_649471654.txt TLE 2042 ms 31768 KB
SubTask2/rand_693017484.txt TLE 2039 ms 31876 KB
SubTask2/rand_729197057.txt TLE 2037 ms 31792 KB
SubTask2/rand_759630883.txt TLE 2044 ms 31800 KB
SubTask2/rand_823752210.txt TLE 2040 ms 31764 KB
SubTask2/rand_830399384.txt TLE 2041 ms 31672 KB
SubTask2/rand_893242387.txt TLE 2039 ms 31800 KB
SubTask2/rand_935005824.txt TLE 2041 ms 31804 KB
SubTask2/rand_989703310.txt TLE 2038 ms 31668 KB