답안 #1008461

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1008461 2024-06-26T12:50:07 Z ASN49K Skyscraper (JOI16_skyscraper) C++14
컴파일 오류
0 ms 0 KB
#define int long long
#include <bits/stdc++.h>
#define pb      push_back
#define all(x)  x.begin(),x.end()
using namespace std;
using i64 =long long;
const int mod=1e9+7;
const int inf=1e9;
const int N=100;
const int L=1'000;
int dp[2][N+2][L+1][3];
//nr de vecini liberi
void add_self(int& x,int y)
{
    x+=y;
    x%=mod;
}
int add(int x,int y)
{
    return (x+y)%mod;
}
int prod(int x,int y)
{
    return (1LL*x*y)%mod;
}
main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,l;
    cin>>n>>l;
    vector<int>a(n);
    for(auto &c:a)
    {
        cin>>c;
    }
    sort(all(a));
    a.pb(1e6);
    dp[1][0][0][0]=1;
    for(int i=0;i<n;i++)
    {
        for(int j=1;j<=i+1;j++)
        {
            for(int cost=0;cost<=l;cost++)
            {
                for(int m=0;m<=2;m++)
                {
                    int& rez=dp[i&1][j][cost][m];
                    rez=0;
 
                    int old_cost=cost-(2*j-m)*(a[i+1]-a[i]);
                    if(old_cost<0)
                    {
                        continue;
                    }
                    //unim 2 comp
                    add_self(rez , prod((j+1-m)*j, dp[(i&1)^1][j+1][old_cost][m]));
                    if(i==n-1)
                    {
                        add_self(rez , dp[(i&1)^1][j+1][old_cost][m]);
                    }
 
                    //adaugam la un capat unei comp
                    //e capat
                    if(m>0)
                    {
                        //aici de gandit coef
 
                        if(m==1)add_self(rez , prod(2*j , dp[(i&1)^1][j][old_cost][m-1]));
                        else if(i==n-1)add_self(rez , dp[(i&1)^1][j][old_cost][m-1]);
                        else if(j>1)add_self(rez , prod(j-1 , dp[(i&1)^1][j][old_cost][m-1]));
                    }
                    add_self(rez , prod(2*j-m , dp[(i&1)^1][j][old_cost][m]));
 
                    //adaugam o noua componenta
                    add_self(rez , dp[(i&1)^1][j-1][old_cost][m]);
                    if(m>0)
                    {
                        add_self(rez , (3-m)*dp[(i&1)^1][j-1][old_cost][m-1]);
                    }
                }
            }
        }
        dp[1][0][0][0]=0;
    }
    int rez=0;
    for(int i=0;i<=l;i++)
    {
        add_self(rez , dp[(n&1)^1][1][i][2]);
    }
    cout<<rez;
}

Compilation message

skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:13: error: 'long' and 'short' specified together
    1 | #define int long long
      |             ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:13: error: 'long' and 'short' specified together
    1 | #define int long long
      |             ^~~~
skyscraper.cpp:1:13: error: 'long' and 'short' specified together
    1 | #define int long long
      |             ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:13: error: 'long' and 'short' specified together
    1 | #define int long long
      |             ^~~~
skyscraper.cpp:1:13: error: 'long' and 'short' specified together
    1 | #define int long long
      |             ^~~~
In file included from /usr/include/c++/10/cmath:42,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from skyscraper.cpp:2:
/usr/include/c++/10/bits/cpp_type_traits.h:242:12: error: redefinition of 'struct std::__is_integer<long long int>'
  242 |     struct __is_integer<long long>
      |            ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/cpp_type_traits.h:214:12: note: previous definition of 'struct std::__is_integer<long long int>'
  214 |     struct __is_integer<int>
      |            ^~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/cpp_type_traits.h:249:12: error: redefinition of 'struct std::__is_integer<long long unsigned int>'
  249 |     struct __is_integer<unsigned long long>
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/cpp_type_traits.h:221:12: note: previous definition of 'struct std::__is_integer<long long unsigned int>'
  221 |     struct __is_integer<unsigned int>
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/10/cmath:43,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from skyscraper.cpp:2:
/usr/include/c++/10/ext/type_traits.h:95:12: error: redefinition of 'struct __gnu_cxx::__add_unsigned<long long int>'
   95 |     struct __add_unsigned<long long>
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/ext/type_traits.h:87:12: note: previous definition of 'struct __gnu_cxx::__add_unsigned<long long int>'
   87 |     struct __add_unsigned<int>
      |            ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/ext/type_traits.h:138:12: error: redefinition of 'struct __gnu_cxx::__remove_unsigned<long long unsigned int>'
  138 |     struct __remove_unsigned<unsigned long long>
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/ext/type_traits.h:130:12: note: previous definition of 'struct __gnu_cxx::__remove_unsigned<long long unsigned int>'
  130 |     struct __remove_unsigned<unsigned int>
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/10/cmath:45,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from skyscraper.cpp:2:
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:13: error: 'long long long' is too long for GCC
    1 | #define int long long
      |             ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:13: error: 'long long long' is too long for GCC
    1 | #define int long long
      |             ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:13: error: 'long long long' is too long for GCC
    1 | #define int long long
      |             ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:13: error: 'long long long' is too long for GCC
    1 | #define int long long
      |             ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:13: error: 'long long long' is too long for GCC
    1 | #define int long long
      |             ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:13: error: 'long long long' is too long for GCC
    1 | #define int long long
      |             ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:13: error: 'long long long' is too long for GCC
    1 | #define int long long
      |             ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:13: error: 'long long long' is too long for GCC
    1 | #define int long long
      |             ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:13: error: 'long long long' is too long for GCC
    1 | #define int long long
      |             ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:13: error: 'long long long' is too long for GCC
    1 | #define int long long
      |             ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:13: error: 'long long long' is too long for GCC
    1 | #define int long long
      |             ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:13: error: 'long long long' is too long for GCC
    1 | #define int long long
      |             ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:13: error: 'long long long' is too long for GCC
    1 | #define int long long
      |             ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:13: error: 'long long long' is too long for GCC
    1 | #define int long long
      |             ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:13: error: 'long long long' is too long for GCC
    1 | #define int long long
      |             ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:13: error: 'long long long' is too long for GCC
    1 | #define int long long
      |             ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:13: error: 'long long long' is too long for GCC
    1 | #define int long long
      |             ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:13: error: 'long long long' is too long for GCC
    1 | #define int long long
      |             ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:13: error: 'long long long' is too long for GCC
    1 | #define int long long
      |             ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:13: error: 'long long long' is too long for GCC
    1 | #define int long long
      |             ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long
      |                  ^~~~
skyscraper.cpp:1:18: error: 'long long long' is too long for GCC
    1 | #define int long long