QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#54670#4190. Grid DeliveryT3alaadl3k2olyehymn3kRE 3ms5928kbC++1.6kb2022-10-10 03:17:102022-10-10 03:17:12

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-10 03:17:12]
  • 评测
  • 测评结果:RE
  • 用时:3ms
  • 内存:5928kb
  • [2022-10-10 03:17:10]
  • 提交

answer

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define sz(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define gtr(T) vector<T>,greater<T>
#define int long long
using namespace std;
using namespace __gnu_pbds;
template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void err(istream_iterator<string> it) { cerr << endl; }

template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

#define S second
#define F first
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
const int N = 2000;
int a[N][N], n, m;

bool work() {
    int curR = 1, curC = 1;
    bool flag = 0;
    for (int i = curR; i <= n; i++) {
        for (int j = curC; j <= m; j++) {
            if (a[i][j] == 1)
                curC = j, a[i][j] = 0, flag = 1;
        }
    }
    return flag;
}

signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            char x;
            cin >> x;
            a[i][j] = x == 'C';
        }
    }
    int cnt = 0;
    while (work())
        cnt++;
    cout << cnt << endl;
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 3592kb

input:

4 4
__C_
C_C_
_C_C
_CCC

output:

2

result:

ok single line: '2'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3476kb

input:

4 6
CC____
_CCC__
___C_C
C__CCC

output:

2

result:

ok single line: '2'

Test #3:

score: 0
Accepted
time: 2ms
memory: 3704kb

input:

3 5
CC__C
_C_CC
CCCCC

output:

3

result:

ok single line: '3'

Test #4:

score: 0
Accepted
time: 2ms
memory: 3544kb

input:

4 4
__C_
CCCC
___C
_C_C

output:

2

result:

ok single line: '2'

Test #5:

score: 0
Accepted
time: 2ms
memory: 3660kb

input:

1 1
_

output:

0

result:

ok single line: '0'

Test #6:

score: 0
Accepted
time: 2ms
memory: 3600kb

input:

1 1
C

output:

1

result:

ok single line: '1'

Test #7:

score: 0
Accepted
time: 2ms
memory: 3504kb

input:

10 10
__________
__________
__________
__________
__________
__________
__________
__________
__________
__________

output:

0

result:

ok single line: '0'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3732kb

input:

10 10
_________C
_________C
_C__C_____
__________
____C_____
_________C
_______C__
__________
______C___
_______C__

output:

3

result:

ok single line: '3'

Test #9:

score: 0
Accepted
time: 2ms
memory: 3620kb

input:

10 10
C_C__C____
___C__C_CC
_CCC___C__
__C_CCC__C
__C_____CC
_CCCCC_CCC
C_C_CC_CCC
____C_C___
CC____CCCC
C___C___C_

output:

7

result:

ok single line: '7'

Test #10:

score: 0
Accepted
time: 2ms
memory: 3632kb

input:

10 10
CCCCCCCCCC
CCC_CC__CC
CCCCCC_CCC
_CCCCCC_CC
CCCCCCCCCC
C__CCCCCCC
CCCCCCCC_C
C_CCCCCCCC
_CCCCCCCCC
CCCCCCCCCC

output:

10

result:

ok single line: '10'

Test #11:

score: 0
Accepted
time: 2ms
memory: 3636kb

input:

10 10
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCC_
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC

output:

10

result:

ok single line: '10'

Test #12:

score: 0
Accepted
time: 3ms
memory: 5928kb

input:

100 100
____________________________________________________________________________________________________
____________________________________________________________________________________________________
__________________________________________________________________________________________...

output:

0

result:

ok single line: '0'

Test #13:

score: 0
Accepted
time: 0ms
memory: 5816kb

input:

100 100
__C_____________________C__________________C____C____________________________C______________________
______________C__________C__C_C____C___CC___C_C_C__________C_____C____C____C________________CC____C_
____C____________C_____________C_____C_C_________C____________________C_______C___________...

output:

44

result:

ok single line: '44'

Test #14:

score: 0
Accepted
time: 3ms
memory: 5648kb

input:

100 100
C_C_CCCC_C_CCC__C_CC_CC_C____CCC__CCCC__CCC_C__CC_CC_CCC__C___CCC_CCCC_CCC_________CCCCCCC_CC____C_C
CC_C__CCC_CCC_CC_____CCC___C_CC____C_C__CC_C___C_CC___CCCC_C_C________C___C___CC_CC__CCC________C___
___C_C_CC___CCC_______C_C___CCC_C_____C__CC_____CC_____C__CCC_C__CC_C_C_C_CC_C__C__C__C_CC...

output:

81

result:

ok single line: '81'

Test #15:

score: 0
Accepted
time: 3ms
memory: 4176kb

input:

100 100
CCCCC_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC__CCCCCCCCC_CCCCCCCCCC_CCC_CCC_CCCCCCCCCCCCCCC_CCC_CCCC_CCCCCC
CCCCCCCCCCCC_CCCCCCCCCCCCCCC_CCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCC__C__CCCCC_C__CCCCCCCC_CCC_CCCCCC_CCCC
CCCCCCCCCCCCCCCC_CCC_CCC_CCCCCCC_CCCCC_CCCCC_CCCCC__CCCCCCCCCCCCCCCCCCCCCCCCC_CCCC_CC_CCCC...

output:

95

result:

ok single line: '95'

Test #16:

score: 0
Accepted
time: 1ms
memory: 4004kb

input:

100 100
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

100

result:

ok single line: '100'

Test #17:

score: -100
Runtime Error

input:

2000 2000
__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________...

output:


result: