Submission #4600836


Source Code Expand

Copy
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <unordered_map>
#define MOD (1000000007l)

using namespace std;

int main(void) {
  vector<long> original;
  long N;
  cin >> N;

  long before = 0;
  for (long i = 0; i < N; i++) {
    long tmp;
    cin >> tmp;
    if (tmp != before) {
      original.push_back(tmp);
      before = tmp;
    }
  }

/*
  for (auto v: original) cerr << v << endl;
  cerr << endl;
*/

  unordered_map<long, long> selecting;
  long ret = 1;

  for (long v: original) {
    ret = (ret + selecting[v]) % MOD;
    selecting[v] = ret;
  }

  cout << ret << endl;

  return 0;
}

Submission Info

Submission Time
Task B - Reversi
User set0gut1
Language C++14 (GCC 5.4.1)
Score 700
Code Size 682 Byte
Status
Exec Time 88 ms
Memory 10096 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 s1.txt, s2.txt, s3.txt
All 700 / 700 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, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
01.txt 88 ms 8688 KB
02.txt 88 ms 8688 KB
03.txt 88 ms 8688 KB
04.txt 88 ms 8688 KB
05.txt 49 ms 2420 KB
06.txt 49 ms 2420 KB
07.txt 49 ms 2420 KB
08.txt 49 ms 2420 KB
09.txt 38 ms 2420 KB
10.txt 38 ms 2420 KB
11.txt 35 ms 1400 KB
12.txt 35 ms 1400 KB
13.txt 88 ms 10096 KB
14.txt 88 ms 10096 KB
15.txt 77 ms 5872 KB
16.txt 77 ms 5872 KB
17.txt 77 ms 5872 KB
18.txt 77 ms 5872 KB
19.txt 73 ms 5232 KB
20.txt 73 ms 5232 KB
21.txt 70 ms 5872 KB
22.txt 70 ms 5872 KB
23.txt 31 ms 256 KB
24.txt 70 ms 5872 KB
25.txt 1 ms 256 KB
26.txt 1 ms 256 KB
27.txt 1 ms 256 KB
28.txt 1 ms 256 KB
29.txt 1 ms 256 KB
30.txt 1 ms 256 KB
s1.txt 1 ms 256 KB
s2.txt 1 ms 256 KB
s3.txt 1 ms 256 KB