94032024-02-21 12:54:25Leventusz09Táblajáték 2 (70 pont)csharpWrong answer 28/7032ms26316 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/030ms22056 KiB
2Wrong answer0/030ms22336 KiB
3Accepted2/232ms22436 KiB
4Partially correct1/332ms22992 KiB
5Accepted3/330ms23144 KiB
6Partially correct1/330ms23760 KiB
7Accepted3/330ms24036 KiB
8Partially correct1/332ms24608 KiB
9Partially correct1/332ms24796 KiB
10Partially correct1/332ms24700 KiB
11Accepted3/330ms24924 KiB
12Partially correct1/332ms24952 KiB
13Partially correct1/332ms25608 KiB
14Partially correct1/332ms25832 KiB
15Partially correct1/432ms25960 KiB
16Partially correct1/432ms26224 KiB
17Partially correct1/432ms26092 KiB
18Partially correct1/430ms25960 KiB
19Partially correct1/430ms26092 KiB
20Partially correct1/432ms26040 KiB
21Partially correct1/432ms26140 KiB
22Partially correct1/432ms26236 KiB
23Partially correct1/332ms26316 KiB