提出 #1828800


ソースコード 拡げる

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

namespace ABC080C
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] F = new int[N + 1];
            int[,] P = new int[N + 1, 10 + 1];
            string[] vals;

            for(int i=1; i<=N; i++)
            {
                vals = Console.ReadLine().Split();
                for (int j = 0; j < 10; j++)
                {
                    F[i] <<= 1;
                    F[i] |= int.Parse(vals[j]);
                }
                
            }

            for(int i=1; i<=N; i++)
            {
                vals = Console.ReadLine().Split();
                for(int j=0; j<=10; j++)
                {
                    P[i, j] = int.Parse(vals[j]);
                }
            }

            long max = long.MinValue;
            long b;

            for(int jf = 1; jf<=1023; jf++)
            {
                b = 0;
                for(int i=1; i<=N; i++)
                {
                    int flag = jf & F[i];
                    int count = bitCount(flag);
                    b += P[i, count];
                }
                if (max < b)
                    max = b;
            }

            Console.WriteLine(max);

        }
        

        static int bitCount(int n)
        {
            int ret = 0;
            while(n > 0)
            {
                ret += n & 0x01;
                n >>= 1;
            }
            return ret;
        }
    }
}

提出情報

提出日時
問題 C - Shopping Street
ユーザ hogeki
言語 C# (Mono 4.6.2.0)
得点 300
コード長 1679 Byte
結果 AC
実行時間 24 ms
メモリ 11092 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 19
セット名 テストケース
Sample sample_01.txt, sample_02.txt, sample_03.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, sample_01.txt, sample_02.txt, sample_03.txt
ケース名 結果 実行時間 メモリ
01.txt AC 23 ms 9044 KiB
02.txt AC 23 ms 11092 KiB
03.txt AC 23 ms 11092 KiB
04.txt AC 23 ms 11092 KiB
05.txt AC 23 ms 11092 KiB
06.txt AC 22 ms 9044 KiB
07.txt AC 23 ms 11092 KiB
08.txt AC 23 ms 11092 KiB
09.txt AC 23 ms 11092 KiB
10.txt AC 22 ms 9044 KiB
11.txt AC 23 ms 9044 KiB
12.txt AC 22 ms 11092 KiB
13.txt AC 21 ms 9044 KiB
14.txt AC 23 ms 11092 KiB
15.txt AC 24 ms 11092 KiB
16.txt AC 22 ms 9044 KiB
sample_01.txt AC 20 ms 9044 KiB
sample_02.txt AC 21 ms 11092 KiB
sample_03.txt AC 21 ms 11092 KiB