提出 #548762
ソースコード 拡げる
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
using namespace std;
typedef long long ll;
struct range {
int start, end, target;
range(int s, int e, int t) {
start = s;
end = e;
target = t;
}
};
const ll BLACK = -1LL;
const ll WHITE = 0LL;
const int MAX = 100000;
vector<ll> field;
vector<range> list;
ll move(ll s, ll c) {
ll start = s;
ll cnt = 0;
while(cnt != c) {
for(range r : list) {
if(r.start <= s && s <= r.end) {
s = r.target;
break;
}
}
if(field[s] == WHITE) {
field[s] = BLACK;
++cnt;
if(cnt == c) break;
++s;
}
}
list.push_back(range(start, s, s+1));
return s;
}
int main() {
ll N;
cin >> N;
vector<ll> S(N, 0LL);
vector<ll> C(N, 0LL);
field.assign(MAX+2, WHITE);
rep(i, N) { cin >> S[i] >> C[i]; }
vector<ll> res(N, 0LL);
rep(i, N) {
res[i] = move(S[i], C[i]);
}
rep(i, N) {
cout << res[i] << endl;
}
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | D - マスと駒と色塗り |
| ユーザ | kengo92i |
| 言語 | C++11 (Clang++ 3.4) |
| 得点 | 0 |
| コード長 | 1542 Byte |
| 結果 | TLE |
| 実行時間 | 2035 ms |
| メモリ | 4444 KiB |
ジャッジ結果
| セット名 | Sample | Dataset1 | Dataset2 | Dataset3 | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 0 / 35 | 0 / 40 | 0 / 25 | ||||||||||||||||||
| 結果 |
|
|
|
|
| セット名 | テストケース |
|---|---|
| Sample | sample-01.txt, sample-02.txt, sample-03.txt |
| Dataset1 | sample-01.txt, sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt |
| Dataset2 | sample-01.txt, sample-02.txt, sample-03.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, 02-08.txt, 02-09.txt, 02-10.txt, 02-11.txt, 02-12.txt |
| Dataset3 | sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, 02-08.txt, 02-09.txt, 02-10.txt, 02-11.txt, 02-12.txt, 03-01.txt, 03-02.txt, 03-03.txt, 03-04.txt, 03-05.txt, 03-06.txt, 03-07.txt, 03-08.txt, 03-09.txt, 03-10.txt, 03-11.txt, 03-12.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 01-01.txt | TLE | 2033 ms | 3620 KiB |
| 01-02.txt | TLE | 2033 ms | 4008 KiB |
| 01-03.txt | TLE | 2033 ms | 4444 KiB |
| 01-04.txt | TLE | 2034 ms | 3352 KiB |
| 01-05.txt | AC | 27 ms | 1688 KiB |
| 01-06.txt | AC | 36 ms | 1572 KiB |
| 01-07.txt | AC | 397 ms | 1572 KiB |
| 01-08.txt | TLE | 2034 ms | 1948 KiB |
| 01-09.txt | TLE | 2033 ms | 3528 KiB |
| 02-01.txt | RE | 291 ms | 1688 KiB |
| 02-02.txt | RE | 287 ms | 1568 KiB |
| 02-03.txt | RE | 281 ms | 1684 KiB |
| 02-04.txt | AC | 316 ms | 1680 KiB |
| 02-05.txt | RE | 284 ms | 1692 KiB |
| 02-06.txt | RE | 284 ms | 1580 KiB |
| 02-07.txt | RE | 281 ms | 1572 KiB |
| 02-08.txt | RE | 273 ms | 1568 KiB |
| 02-09.txt | RE | 277 ms | 1580 KiB |
| 02-10.txt | RE | 276 ms | 1568 KiB |
| 02-11.txt | RE | 277 ms | 1572 KiB |
| 02-12.txt | RE | 277 ms | 1568 KiB |
| 03-01.txt | RE | 425 ms | 3876 KiB |
| 03-02.txt | RE | 432 ms | 3872 KiB |
| 03-03.txt | RE | 432 ms | 3872 KiB |
| 03-04.txt | TLE | 2035 ms | 4064 KiB |
| 03-05.txt | RE | 388 ms | 3872 KiB |
| 03-06.txt | RE | 427 ms | 3872 KiB |
| 03-07.txt | RE | 431 ms | 3924 KiB |
| 03-08.txt | RE | 415 ms | 3868 KiB |
| 03-09.txt | RE | 402 ms | 3868 KiB |
| 03-10.txt | RE | 300 ms | 1812 KiB |
| 03-11.txt | RE | 425 ms | 3872 KiB |
| 03-12.txt | RE | 425 ms | 3876 KiB |
| sample-01.txt | AC | 28 ms | 1496 KiB |
| sample-02.txt | AC | 27 ms | 1688 KiB |
| sample-03.txt | RE | 281 ms | 1692 KiB |