Submission #155253


Source Code Expand

//include

//------------------------------------------

#include <vector>

#include <list>

#include <map>

#include <set>

#include <deque>

#include <stack>

#include <bitset>

#include <algorithm>

#include <functional>

#include <numeric>

#include <utility>

#include <sstream>

#include <iostream>

#include <iomanip>

#include <cstdio>

#include <cmath>

#include <cstdlib>

#include <cctype>

#include <string>

#include <cstring>

#include <ctime>



using namespace std;



//conversion

//------------------------------------------

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}

template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}



//math

//-------------------------------------------

template<class T> inline T sqr(T x) {return x*x;}



//typedef

//------------------------------------------

typedef vector<int> VI;

typedef vector<VI> VVI;

typedef vector<string> VS;

typedef pair<int, int> PII;

typedef long long LL;



//container util

//------------------------------------------

#define ALL(a)  (a).begin(),(a).end()

#define RALL(a) (a).rbegin(), (a).rend()

#define PB push_back

#define MP make_pair

#define SZ(a) int((a).size())

#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)

#define EXIST(s,e) ((s).find(e)!=(s).end())

#define SORT(c) sort((c).begin(),(c).end())



//repetition

//------------------------------------------

#define FOR(i,a,b) for(int i=(a);i<(b);i++)

#define REP(i,n)  FOR(i,0,n)



//constant

//--------------------------------------------

const double EPS = 1e-10;

const double PI  = acos(-1.0);



//clear memory

//-------------------------------------------

#define CLR(a) memset((a), 0 ,sizeof(a))



//debug

//-------------------------------------------

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

unsigned long Tri(int n){
  if (n <= 2) {
    return 0;
  }
  else if (n == 3) {
    return 1;
  }
  else {
    return Tri(n-1) + Tri(n-2) + Tri(n-3);
  }
}

int main(int argc, const char * argv[])

{
  int n;
  cin >> n;
  cout << Tri(n) % 10007 << endl;
  
  return 0;
  
}

Submission Info

Submission Time
Task B - トリボナッチ数列
User kikunantoka
Language C++ (G++ 4.6.4)
Score 0
Code Size 2419 Byte
Status TLE
Exec Time 2034 ms
Memory 32172 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 8
TLE × 25
Set Name Test Cases
All test_1.txt, test_1000000.txt, test_1002.txt, test_104.txt, test_107843.txt, test_10980.txt, test_1212.txt, test_1238.txt, test_13194.txt, test_14.txt, test_16.txt, test_2.txt, test_210782.txt, test_21694.txt, test_243.txt, test_24916.txt, test_278.txt, test_3.txt, test_31.txt, test_32.txt, test_42.txt, test_5555.txt, test_567914.txt, test_61868.txt, test_765671.txt, test_8195.txt, test_8353.txt, test_9.txt, test_9625.txt, test_97.txt, test_998.txt, test_999998.txt, test_999999.txt
Case Name Status Exec Time Memory
sample_01.txt AC 23 ms 760 KB
sample_02.txt AC 21 ms 924 KB
sample_03.txt TLE 2030 ms 4012 KB
test_1.txt AC 21 ms 704 KB
test_1000000.txt TLE 2034 ms 32164 KB
test_1002.txt TLE 2029 ms 940 KB
test_104.txt TLE 2028 ms 796 KB
test_107843.txt TLE 2029 ms 4252 KB
test_10980.txt TLE 2029 ms 1188 KB
test_1212.txt TLE 2028 ms 932 KB
test_1238.txt TLE 2029 ms 932 KB
test_13194.txt TLE 2029 ms 1316 KB
test_14.txt AC 21 ms 804 KB
test_16.txt AC 26 ms 800 KB
test_2.txt AC 20 ms 796 KB
test_210782.txt TLE 2030 ms 7468 KB
test_21694.txt TLE 2029 ms 1568 KB
test_243.txt TLE 2028 ms 924 KB
test_24916.txt TLE 2029 ms 1584 KB
test_278.txt TLE 2028 ms 804 KB
test_3.txt AC 21 ms 800 KB
test_31.txt AC 214 ms 800 KB
test_32.txt AC 377 ms 800 KB
test_42.txt TLE 2030 ms 864 KB
test_5555.txt TLE 2028 ms 1056 KB
test_567914.txt TLE 2031 ms 18604 KB
test_61868.txt TLE 2029 ms 2856 KB
test_765671.txt TLE 2032 ms 24748 KB
test_8195.txt TLE 2029 ms 1060 KB
test_8353.txt TLE 2029 ms 1064 KB
test_9.txt AC 21 ms 800 KB
test_9625.txt TLE 2029 ms 1188 KB
test_97.txt TLE 2030 ms 808 KB
test_998.txt TLE 2030 ms 936 KB
test_999998.txt TLE 2033 ms 32156 KB
test_999999.txt TLE 2033 ms 32172 KB