94042024-02-21 12:54:25Leventusz09Táblajáték 2 (70 pont)csharpWrong answer 28/7032ms25844 KiB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Táblajáték_2{
    class Program{
        static void Main(){
            int K = int.Parse(Console.ReadLine());
            int[] S = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //K = 80;
            //S = "1 0 2 1 0 2 1 0 2 4 3 2 3 2 5 5 0 2 0 3 0 2 4 5 4 0 5 5 5 2 4 4 2 3 4 4 0 4 3 3 0 3 5 4 3 0 2 2 1 1 4 4 2 1 3 0 0 1 3 0 3 1 3 2 5 5 4 2 2 3 2 5 4 0 0 5 4 3 4 1".Split().Select(int.Parse).ToArray();


            /*string o1 = "00";

            for(int i=0, l; i<K; i++){
                l = o1.Length;
                if (S[i] == 0) o1 += "0";
                else if (S[i] == 1) o1 += "1";
                else if (S[i] == 2) o1 += "2";
                else if (S[i] == 3) o1 = o1.Substring(0, l - 1);
                else if (S[i] == 4) 
                    
                    if (o1[l - 1] == '0') 
                        o1 = o1.Substring(0, l - 2) + (int.Parse(o1[l - 2] + "") - 1) + "2"; 
                    else 
                        o1 = o1.Substring(0, l - 1) + (int.Parse(o1[l - 1] + "") - 1);
                else 
                    if (o1[l - 1] == '2')
                        o1 = o1.Substring(0, l - 2) + (int.Parse(o1[l - 2] + "") + 1) + "0"; 
                    else 
                        o1 = o1.Substring(0, l - 1) + (int.Parse(o1[l - 1] + "") + 1);
            }
            int o2 = int.Parse(o1);*/

            int r = 0, c = 0;

            foreach(int i in S){
                if (i == 0){
                    r++;
                    c *= 3;
                }else if (i == 1){
                    r++;
                    c = c * 3 + 1;
                }else if (i == 2){
                    r++;
                    c = c * 3 + 2;
                }else if (i == 3){
                    r--;
                    c /= 3;
                }else if (i == 4){
                    c--;
                }else c++;
            }

            string o1 = "";
            for(; c > 0;){
                o1 += (c % 3);
                c /= 3;
            }
            string o2 = "";
            for (int i = o1.Length - 1; i >= 0; i--) o2 += o1[i];
            Console.WriteLine("{0}\n{1}", r, o2);
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base28/70
1Accepted0/030ms22064 KiB
2Wrong answer0/030ms22612 KiB
3Accepted2/232ms22792 KiB
4Partially correct1/332ms23252 KiB
5Accepted3/330ms23352 KiB
6Partially correct1/332ms23712 KiB
7Accepted3/332ms23900 KiB
8Partially correct1/330ms23728 KiB
9Partially correct1/332ms24184 KiB
10Partially correct1/332ms24556 KiB
11Accepted3/332ms24872 KiB
12Partially correct1/332ms24296 KiB
13Partially correct1/332ms24516 KiB
14Partially correct1/332ms24800 KiB
15Partially correct1/430ms25012 KiB
16Partially correct1/432ms25292 KiB
17Partially correct1/432ms25112 KiB
18Partially correct1/430ms25476 KiB
19Partially correct1/430ms25660 KiB
20Partially correct1/432ms25576 KiB
21Partially correct1/432ms25572 KiB
22Partially correct1/432ms25404 KiB
23Partially correct1/332ms25844 KiB