Submission #1193695


Source Code Expand

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

    class Program
    {
    static int d;
   static int t;
   static int[] c=new int[8];
   static int[] a=new int[8];
    static void Main()
        {
        
        for (int b = 0; b < 1000; b++)
            {
            string[] e = Console.ReadLine().Split();
            string[] f = Console.ReadLine().Split();
            string[] g = Console.ReadLine().Split();
            int s=0;
            int o=0;
            d=int.Parse(e[0]);
            t = int.Parse(e[1]);
            for(int h=0;h<8;h++)
            {
                c[h]= int.Parse(f[h]);
            }
            for (int h = 0; h < 8; h++)
            {
                a[h] = int.Parse(g[h]);
            }

            for (int i = 0; i < 8; i++)
                {
                for( int j = 0;j<8;j++ )
                {
                    if(s==1)
                    {
                        Console.Out.WriteLine("fill " + o);
                        Console.Out.Flush();
                        s = 0;
                        o = 0;
                        break;
                    }
                    if (i == j) { break; }
                    if (a[i] == d)
                    {
                        Console.Out.WriteLine("sell 1 " + (i + 1) );
                        Console.Out.Flush();
                        break;


                    }
                    if (a[i] + a[j] == d) 
                    {
                        Console.Out.WriteLine("sell 2 " + (i + 1)+" "+(j+1));
                        Console.Out.Flush();
                        break;
                    }
                    else if (c[i] == d && t != 1)
                    {
                        Console.Out.WriteLine("fill " + (i + 1));
                        Console.Out.Flush();
                        break;
                    }
                    else if (c[i]+c[j] == d && t > 2)
                    {
                        Console.Out.WriteLine("fill " + (i + 1));
                        Console.Out.Flush();
                        s = 1;
                        o = j + 1;
                        break;
                    }
                    else if (i == 7&&j==7)
                    {

                        Console.Out.WriteLine("pass");
                        Console.Out.Flush();
                    }
                }
            }
               
               
               
            }
        }
    }

Submission Info

Submission Time
Task A - 石油王Xの憂鬱
User kazuma0824
Language C++14 (GCC 5.4.1)
Score 0
Code Size 2631 Byte
Status CE

Compile Error

./Main.cpp:1:7: error: expected nested-name-specifier before ‘System’
 using System;
       ^
./Main.cpp:2:7: error: expected nested-name-specifier before ‘System’
 using System.Collections.Generic;
       ^
./Main.cpp:3:7: error: expected nested-name-specifier before ‘System’
 using System.Linq;
       ^
./Main.cpp:4:7: error: expected nested-name-specifier before ‘System’
 using System.Text;
       ^
./Main.cpp:5:7: error: expected nested-name-specifier before ‘System’
 using System.Threading.Tasks;
       ^
./Main.cpp:11:14: error: expected unqualified-id before ‘[’ token
    static int[] c=new int[8];
              ^
./Main.cpp:12:14: error: expected unqualified-id before ‘[’ token
    static int[] a=new int[8];
              ^
./Main.cpp:88:5: error: expected ‘;’ after class definition
     }
     ^
./Main.cpp: In static member function ‘static void Program::Main()’:
./Main.cpp:18:13: error: ‘string’ was not declared in this scope
             string[] e = Console.ReadLine().Split();
           ...