提交记录 18735


用户 题目 状态 得分 用时 内存 语言 代码长度
2020203583 test. 自定义测试 Accepted 100 4.031 ms 23704 KB C++ 966 B
提交时间 评测时间
2022-12-09 12:33:47 2023-09-03 19:42:21
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

vector <int> v[1005][1005];
int check(int x) 
{
    return x * (x + 1) / 2;
}
int main(){
    int n, m, y, x;
    string s;
    cin >> n >> m >> y >> x;
    cin >> s;
    for (int i = 0; i < s.size(); i++)
    {
        v[x][y].push_back(i + 1);
        if (s[i] == 'N') x++;
        if (s[i] == 'S') x--;
        if (s[i] == 'W') y--;
        if (s[i] == 'E') y++;
        if (x < 1 || x > n || y < 1 || y > n)
        {
            return 0;
        }
    }
    for (int i = n; i >= 1; i--)
    {
        for (int j = 1; j <= n; j++)
        {
            v[i][j].push_back(s.size() + 1);
            int ans = 0, now = 0;
            for (int k = 0; k < v[i][j].size(); k++)
            {
                ans += check(v[i][j][k] - now -1);
                now = v[i][j][k];
            }
            printf("%d ", ans);
        }
        printf("\n");
        
    }
    return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #14.031 ms23 MB + 152 KBAcceptedScore: 100


Judge Duck Online | 评测鸭在线
Server Time: 2025-09-16 20:50:33 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠