QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#386873#5112. Where Am I?Energy_is_not_over#Compile Error//C++173.2kb2024-04-11 20:53:252024-04-11 20:53:27

Judging History

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

  • [2024-04-11 20:53:27]
  • 评测
  • [2024-04-11 20:53:25]
  • 提交

answer

//
// Stvoreno ENERGom o 11.04.24. 14:31:54
//

#include <bits/stdc++.h>

#define all(a) a.begin(),a.end()
#define len(a) (int)(a.size())
#define F first
#define fir first
#define S second
#define sec second
#define mp make_pair
#define MP make_pair
#define pb push_back
#define PB push_back

using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;

#ifdef Energy
#define DEBUG for (int _____DEBUG=1;_____DEBUG;_____DEBUG=0)

template<class ...Ts>
auto &PRNT(Ts ...ts) { return ((cerr << ts << " "), ...); }

#define LOG(...) PRNT(#__VA_ARGS__" ::",__VA_ARGS__)<<endl
#else
#define DEBUG while (0)
#define LOG(...)
#endif

const int max_n = 1e3+10, inf = 1000111222;

const int max_k=10;

int n,m,k;
bool f[max_k][max_n][max_n];
int dx[max_k];
int dy[max_k];

int known[max_n][max_n];
bool used[max_n][max_n];

inline bool ok_pos(int x,int y)
{
    return 0<=x && x<n && 0<=y && y<m;
}

void dfs(int x,int y)
{
    assert(known[x][y]!=-1);
    used[x][y]=1;

    for (int i=0;i<k;i++){
        if (ok_pos(x+dx[i],y+dy[i]) && known[x][y]==0 && known[x+dx[i]][y+dy[i]]==-1 && !f[i][x+dx[i]][y+dy[i]]){
            known[x+dx[i]][y+dy[i]]=0;
            dfs(x+dx[i],y+dy[i]);
        }
        if (ok_pos(x-dx[i],y-dy[i]) && known[x][y]==1 && known[x-dx[i]][y-dy[i]]==-1 && !f[i][x][y]){
            known[x-dx[i]][y-dy[i]]=1;
            dfs(x-dx[i],y-dy[i]);
        }
    }
}

int main() {
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin>>n>>m>>k;
    for (int i=0;i<k;i++){
        cin>>dx[i]>>dy[i];
//        dx[i]*=-1;
//        dy[i]*=-1;
        int s;
        cin>>s;
        while (s--){
            int a,b;
            cin>>a>>b;
            a--;
            b--;

            f[i][a][b]=1;
        }
    }
    memset(known,-1,sizeof(known));
    for (int i=0;i<k;i++){
        for (int x=0;x<n;x++){
            for (int y=0;y<m;y++){
                if (ok_pos(x+dx[i],y+dy[i])){
                    if (f[i][x+dx[i]][y+dy[i]]){
                        known[x+dx[i]][y+dy[i]]=1;
                        known[x][y]=0;
                    }
                }
                if (f[i][x][y]){
                    known[x][y]=1;
                    if (ok_pos(x-dx[i],y-dy[i])){
                        known[x-dx[i]][y-dy[i]]=0;
                    }
                }
            }
        }
    }
    for (int x=0;x<n;x++){
        for (int y=0;y<m;y++){
            if (known[x][y]!=-1 && !used[x][y]){
                dfs(x,y);
            }
        }
    }
    for (int iter=0;iter<2;iter++){
        for (int y=0;y<m;y++){
            for (int x=0;x<n;x++){
                int res=(known[x][y]==-1 ? iter : known[x][y]);
                assert(res==0 || res==1);
                cout<<(res==0?'.':'#');
            }
            cout<<"\n";
        }
        cout<<"\n";
    }

    exit(0);
}

/home/icpc/workspace/WF/WF21/cmake-build-debug/WF21
5 4 2
1 0 6 1 1 4 1 2 2 5 2 2 3 3 4
0 -1 7 1 1 4 1 5 2 2 3 3 4 4 4 5 4
#..#.
.#..#
.#...
..###

##.##
.##.#
.###.
#.###


Process finished with exit code 0

詳細信息

answer.code:137:2: error: invalid preprocessing directive #.
  137 | #..#.
      |  ^
answer.code:138:2: error: stray ‘#’ in program
  138 | .#..#
      |  ^
answer.code:138:5: error: stray ‘#’ in program
  138 | .#..#
      |     ^
answer.code:139:2: error: stray ‘#’ in program
  139 | .#...
      |  ^
answer.code:140:3: error: stray ‘##’ in program
  140 | ..###
      |   ^~
answer.code:140:5: error: stray ‘#’ in program
  140 | ..###
      |     ^
answer.code:142:1: error: stray ‘##’ in program
  142 | ##.##
      | ^~
answer.code:142:4: error: stray ‘##’ in program
  142 | ##.##
      |    ^~
answer.code:143:2: error: stray ‘##’ in program
  143 | .##.#
      |  ^~
answer.code:143:5: error: stray ‘#’ in program
  143 | .##.#
      |     ^
answer.code:144:2: error: stray ‘##’ in program
  144 | .###.
      |  ^~
answer.code:144:4: error: stray ‘#’ in program
  144 | .###.
      |    ^
answer.code:145:2: error: invalid preprocessing directive #.
  145 | #.###
      |  ^
answer.code:133:1: error: expected unqualified-id before ‘/’ token
  133 | /home/icpc/workspace/WF/WF21/cmake-build-debug/WF21
      | ^