Submission #73347735
Source Code Expand
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#include<random>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int X = 0;X < (int)(Y);++X)
#define reps(X,S,Y) for (int X = (int)(S);X < (int)(Y);++X)
#define rrep(X,Y) for (int X = (int)(Y)-1;X >=0;--X)
#define rreps(X,S,Y) for (int X = (int)(Y)-1;X >= (int)(S);--X)
#define repe(X,Y) for (X = 0;X < (Y);++X)
#define peat(X,Y) for (;X < (Y);++X)
#define all(X) X.begin(),X.end()
#define rall(X) X.rbegin(),X.rend()
#define eb emplace_back
#define UNIQUE(X) X.erase(unique(all(X)),X.end())
#define Endl endl
#define NL <<"\n"
#define cauto const auto
using namespace std;
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
//#undef NUIP
#ifdef NUIP
#include "benri.h"
#else
#define out(args...)
#endif
void ouT(ll x,int d=3){auto re=to_string(x);if((int)re.size()>d) re=x>0?"oo":"-oo";cout<<string(d-re.size(),' ')<<re<<",";}
#ifdef __cpp_init_captures
template<typename T>vector<T> table(int n, T v){ return vector<T>(n, v);}
template <class... Args> auto table(int n, Args... args){auto val = table(args...); return vector<decltype(val)>(n, move(val));}
#endif
template<class A,class B> pair<A,B> operator+(const pair<A,B> &p,const pair<A,B> &q){ return {p.X+q.X,p.Y+q.Y};}
template<class A,class B,class C,class D> pair<A,B>& operator+=(pair<A,B> &p,const pair<C,D> &q){ p.X+=q.X; p.Y+=q.Y; return p;}
template<class A,class B> pair<A,B> operator-(const pair<A,B> &p,const pair<A,B> &q){ return {p.X-q.X,p.Y-q.Y};}
template<class A,class B,class C,class D> pair<A,B>& operator-=(pair<A,B> &p,const pair<C,D> &q){ p.X-=q.X; p.Y-=q.Y; return p;}
template<class A,class B> istream& operator>>(istream &is, pair<A,B> &p){ is>>p.X>>p.Y; return is;}
#ifdef __cpp_init_captures
template<class Tuple, size_t... Is> void read_tuple_impl(istream &is, Tuple& t, index_sequence<Is...>){((is >> get<Is>(t)), ...);}
template<class... Args> auto& operator>>(istream &is, tuple<Args...>& t){ read_tuple_impl(is, t, index_sequence_for<Args...>{}); return is;}
template<typename T, size_t... Is> void addadd(T& t1, const T& t2, integer_sequence<size_t, Is...>){ cauto l = { (get<Is>(t1) += get<Is>(t2), 0)... }; (void)l;}
template <typename...T>tuple<T...>& operator += (tuple<T...>& lhs, const tuple<T...>& rhs){ addadd(lhs, rhs, index_sequence_for<T...>{}); return lhs;}
template <typename...T>tuple<T...> operator +(tuple<T...> lhs, const tuple<T...>& rhs){ return lhs += rhs;}
template<typename T, size_t... Is> void subsub(T& t1, const T& t2, integer_sequence<size_t, Is...>){ cauto l = { (get<Is>(t1) -= get<Is>(t2), 0)... }; (void)l;}
template <typename...T>tuple<T...>& operator -= (tuple<T...>& lhs, const tuple<T...>& rhs){ subsub(lhs, rhs, index_sequence_for<T...>{}); return lhs;}
template <typename...T>tuple<T...> operator - (tuple<T...> lhs, const tuple<T...>& rhs){ return lhs -= rhs;}
#endif
template<class T=ll> T read(){ T re; cin>>re; return re;}
template<class T=ll> T read(const T &dec){ T re; cin>>re; return re-dec;}
template<class T=ll> vector<T> readV(const int sz){ vector<T> re(sz); for(auto &x:re) x=read<T>(); return re;}
template<class T=ll> vector<T> readV(const int sz, const T &dec){ vector<T> re(sz); for(auto &x:re) x=read<T>(dec); return re;}
vv<int> readG(const int &n,const int &m){ vv<int> g(n); rep(_,m){ cauto a=read<int>(1),b=read<int>(1); g[a].pb(b); g[b].pb(a);} return g;}
vv<int> readG(const int &n){ return readG(n,n-1);}
vv<int> readD(const int &n,const int &m){ vv<int> g(n); rep(_,m){ cauto a=read<int>(1),b=read<int>(1); g[a].pb(b); } return g;}
vv<int> readD(const int &n){ return readD(n,n-1);}
template<class T> vv<pair<int,T>> readG(const int &n,const int &m){ vv<pair<int,T>> g(n); rep(_,m){ cauto a=read<int>(1),b=read<int>(1); cauto c=read<T>(); g[a].eb(b,c); g[b].eb(a,c);} return g;}
template<class T> vv<pair<int,T>> readG(const int &n){ return readG<T>(n,n-1);}
template<class T> vv<pair<int,T>> readD(const int &n,const int &m){ vv<pair<int,T>> g(n); rep(_,m){ cauto a=read<int>(1),b=read<int>(1); cauto c=read<T>(); g[a].eb(b,c); } return g;}
template<class T> vv<pair<int,T>> readD(const int &n){ return readD<T>(n,n-1);}
#ifdef __cpp_deduction_guides
template<typename T> vector<T> readT(int n, T v){ return readV(n,v);}
template <class... Args> auto readT(int n, Args... args){ vector re(1,readT(args...));rep(_,n-1) re.eb(readT(args...)); return re;}
#endif
template<class T> bool erase(multiset<T> &st, const T &v){if(cauto it=st.find(v); it==st.end()) return false; else{ st.erase(it); return true;}}
#ifdef NUIP
#define TT cauto TTT=read();rep(kase,TTT)if(cerr<<"Case #"<<kase<<endl)
#else
#define TT cauto TTT=read();rep(kase,TTT)
#endif
struct sorted_impl{template<class T>friend vector<T>operator-(vector<T>a,sorted_impl){sort(all(a));return a;}friend string operator-(string a,sorted_impl){sort(all(a));return a;}}sorted;struct reversed_impl{template<class T>friend vector<T>operator-(vector<T> a,reversed_impl){reverse(all(a));return a;}friend string operator-(string a,reversed_impl){reverse(all(a));return a;}}reversed;struct distinct_impl{template<class T>friend vector<T>operator-(vector<T> a,distinct_impl){sort(all(a));UNIQUE(a);return a;}}distinct;template<class S>struct sortedWith{const S f;sortedWith(const S &f):f(f){}template<class T>friend vector<T>operator-(vector<T> a,const sortedWith&b){sort(all(a),[&](cauto&i,cauto&j){return b.f(i)<b.f(j);});return a;}};
template<class T>int operator/(const T&v,const vector<T>&vs){return lower_bound(all(vs),v)-vs.begin();}
vector<int> Inds(const int n){vector<int> inds(n);iota(all(inds),0);return inds;}
const ll MOD=1e9+7; //998244353;
int main(){
ios_base::sync_with_stdio(false); cin.tie(0);
cout<<fixed<<setprecision(0);
cauto n=read(0);
if(n>30) return 0;
auto dp=table(n,n,set<int>());
dp[0][0].insert(1);
rep(i,n)rep(j,n){
if(i+1<n)for(cauto v:dp[i][j]) dp[i+1][j].insert(v+(i+2)*(j+1));
if(j+1<n)for(cauto v:dp[i][j]) dp[i][j+1].insert(v+(i+1)*(j+2));
}
vector<int> vs(rall(dp[n-1][n-1]));
vs.eb(-1);
rep(i,vs.size())if(vs[0]-i!=vs[i]){
cout<<vs[0]-i NL;
break;
}
return 0;
}
Submission Info
| Submission Time |
|
| Task |
N - Times Table Sum |
| User |
nuip |
| Language |
C++23 (GCC 15.2.0) |
| Score |
1 |
| Code Size |
6791 Byte |
| Status |
WA |
| Exec Time |
108 ms |
| Memory |
52616 KiB |
Judge Result
| Set Name |
Sample |
Subtask |
All |
| Score / Max Score |
0 / 0 |
1 / 1 |
0 / 100 |
| Status |
|
|
|
| Set Name |
Test Cases |
| Sample |
example_00.txt, example_01.txt, example_02.txt |
| Subtask |
example_00.txt, example_01.txt, example_02.txt, subtask_00.txt, subtask_01.txt, subtask_02.txt, subtask_03.txt, subtask_04.txt, subtask_05.txt, subtask_06.txt, subtask_07.txt, subtask_08.txt, subtask_09.txt, subtask_10.txt, subtask_11.txt, subtask_12.txt, subtask_13.txt, subtask_14.txt |
| All |
example_00.txt, example_01.txt, example_02.txt, subtask_00.txt, subtask_01.txt, subtask_02.txt, subtask_03.txt, subtask_04.txt, subtask_05.txt, subtask_06.txt, subtask_07.txt, subtask_08.txt, subtask_09.txt, subtask_10.txt, subtask_11.txt, subtask_12.txt, subtask_13.txt, subtask_14.txt, test_00.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt |
| Case Name |
Status |
Exec Time |
Memory |
| example_00.txt |
AC |
5 ms |
6312 KiB |
| example_01.txt |
AC |
3 ms |
6280 KiB |
| example_02.txt |
AC |
3 ms |
6516 KiB |
| subtask_00.txt |
AC |
3 ms |
6280 KiB |
| subtask_01.txt |
AC |
3 ms |
6456 KiB |
| subtask_02.txt |
AC |
3 ms |
6412 KiB |
| subtask_03.txt |
AC |
3 ms |
6336 KiB |
| subtask_04.txt |
AC |
3 ms |
6400 KiB |
| subtask_05.txt |
AC |
3 ms |
6508 KiB |
| subtask_06.txt |
AC |
3 ms |
6624 KiB |
| subtask_07.txt |
AC |
4 ms |
6916 KiB |
| subtask_08.txt |
AC |
6 ms |
8068 KiB |
| subtask_09.txt |
AC |
8 ms |
8564 KiB |
| subtask_10.txt |
AC |
50 ms |
28168 KiB |
| subtask_11.txt |
AC |
61 ms |
33036 KiB |
| subtask_12.txt |
AC |
75 ms |
38592 KiB |
| subtask_13.txt |
AC |
91 ms |
45172 KiB |
| subtask_14.txt |
AC |
108 ms |
52616 KiB |
| test_00.txt |
WA |
3 ms |
6328 KiB |
| test_01.txt |
WA |
3 ms |
6336 KiB |
| test_02.txt |
WA |
3 ms |
6328 KiB |
| test_03.txt |
WA |
3 ms |
6388 KiB |
| test_04.txt |
WA |
3 ms |
6380 KiB |
| test_05.txt |
WA |
3 ms |
6412 KiB |
| test_06.txt |
WA |
3 ms |
6284 KiB |
| test_07.txt |
WA |
3 ms |
6336 KiB |
| test_08.txt |
WA |
3 ms |
6312 KiB |
| test_09.txt |
WA |
3 ms |
6280 KiB |
| test_10.txt |
WA |
2 ms |
6280 KiB |
| test_11.txt |
WA |
3 ms |
6356 KiB |
| test_12.txt |
WA |
3 ms |
6328 KiB |
| test_13.txt |
WA |
3 ms |
6340 KiB |
| test_14.txt |
WA |
3 ms |
6408 KiB |