Submission #32561306


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef pair<string,string> Pstring;
typedef pair<double,double> Pdouble;


#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define Precision13 cout << fixed << setprecision(13)
const double PI=3.14159265358979323846;
const int MAX = 510000;
const int MOD = 1000000007;
const int INF = 1<<29;
using Graph = vector<vector<ll>>;

int main() {


  vector<ll> h(4);
  vector<ll> w(4);

  ll sumh=0;
  ll sumw=0;

  REP1(i,3){
    cin >> h[i];
    sumh+=h[i];
  }
  REP1(i,3){
    cin >> w[i];
    sumw+=w[i];
  }

  if(sumh!=sumw){
    cout << 0 << endl;
    return 0;
  }

  ll count =0;

  REP1(i,28){
    REP1(j,28){
      REP1(m,28){
        REP1(n,28){
          ll C=h[1]-(i+j);
          ll F=h[2]-(m+n);
          ll G=w[1]-(i+m);
          ll H=w[2]-(j+n);

          if(h[3]-(G+H)==w[3]-(C+F)){
            if(C>0&&F>0){
              if(G>0&&H>0){
                if(h[3]-(G+H)>0){
                  count++;
                }
              }
            }
            
          }
        }
      }
    }
  }

  cout<< count << endl;

}

Submission Info

Submission Time
Task C - Filling 3x3 array
User takkey
Language C++ (GCC 9.2.1)
Score 300
Code Size 1265 Byte
Status AC
Exec Time 9 ms
Memory 3580 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 16
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 02_max_00.txt, 03_min_00.txt, 04_near_max_00.txt, 04_near_max_01.txt, 04_near_max_02.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 5 ms 3424 KiB
00_sample_01.txt AC 2 ms 3560 KiB
00_sample_02.txt AC 2 ms 3552 KiB
00_sample_03.txt AC 4 ms 3580 KiB
01_random_00.txt AC 3 ms 3420 KiB
01_random_01.txt AC 3 ms 3492 KiB
01_random_02.txt AC 2 ms 3436 KiB
01_random_03.txt AC 3 ms 3368 KiB
01_random_04.txt AC 3 ms 3520 KiB
01_random_05.txt AC 2 ms 3564 KiB
01_random_06.txt AC 2 ms 3556 KiB
02_max_00.txt AC 4 ms 3352 KiB
03_min_00.txt AC 2 ms 3568 KiB
04_near_max_00.txt AC 9 ms 3412 KiB
04_near_max_01.txt AC 3 ms 3480 KiB
04_near_max_02.txt AC 6 ms 3352 KiB