Submission #14703859


Source Code Expand

Copy
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005
#define MAX_H 60
#define MAX_W 60

    /*
    いろいろ
    int x = rand()%100;
    double x = (double)rand()/RAND_MAX;
    mt19937 get_rand_mt;
    shuffle(vec.begin(), vec.end(), get_rand_mt);
    int dx[4] = {-1, 1, 0, 0};
    int dy[4] = {0, 0, -1, 1};
    */

int H, W, K;
int a[MAX_H][MAX_W];
int f[MAX_H][MAX_W];

int main() {
    srand((unsigned) time(NULL));
    clock_t start,end;
	start = clock();

    // 入力
    cin >> H >> W >> K;
    srep(i,1,H+1){
        srep(j,1,W+1){
            char c; cin >> c;
            a[i][j] = c - '0';
        }
    }

    // 市松に入れてみる.
    srep(i,1,H+1){
        rep(j,W/K){
            if(i%2 == j%2){
                rep(k,K){
                    f[i][1+j*K+k] = 1;
                }
            }
        }
    }
    
    
    // 更新
	while(true){



        end = clock();
        if((double)(end-start)/CLOCKS_PER_SEC > 0.1)break;
    }

    // 出力
    vector<P> ans;
    rep(i,MAX_H){
        rep(j,MAX_W){
            if(f[i][j] == 1){
                ans.push_back(P(i,j));
            }
        }
    }
    cout << ans.size() / K << endl;
    rep(i,ans.size()) cout << ans[i].first << ' ' << ans[i].second << endl;
    string fileName = "sample_out.txt";
    const char* cstr = fileName.c_str();
    ofstream ofs(cstr);
    ofs << ans.size() / K << endl;
    rep(i,ans.size()) ofs << ans[i].first << ' ' << ans[i].second << endl;
    ofs.close();

    end = clock();
    return 0;
}
 
 

Submission Info

Submission Time
Task A - Multiple Pieces
User Shibuyap
Language C++ (GCC 9.2.1)
Score 25441
Code Size 1859 Byte
Status
Exec Time 120 ms
Memory 3604 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:2:35: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<std::pair<int, int> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
    2 | #define rep(i,n) for(int i = 0; i < (n); ++i)
      |                                   ^
./Main.cpp:72:5: note: in expansion of macro ‘rep’
   72 |     rep(i,ans.size()) cout << ans[i].first << ' ' << ans[i].second << endl;
      |     ^~~
./Main.cpp:2:35: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<std::pair<int, int> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
    2 | #define rep(i,n) for(int i = 0; i < (n); ++i)
      |                                   ^
./Main.cpp:77:5: note: in expansion of macro ‘rep’
   77 |     rep(i,ans.size()) ofs << ans[i].first << ' ' << ans[i].second << endl;
      |     ^~~

Judge Result

Set Name Score / Max Score Test Cases
test_01 2326 / 1343058 subtask_01_01.txt
test_02 1235 / 1343058 subtask_01_02.txt
test_03 2648 / 1343058 subtask_01_03.txt
test_04 2362 / 1343058 subtask_01_04.txt
test_05 2629 / 1343058 subtask_01_05.txt
test_06 2083 / 1343058 subtask_01_06.txt
test_07 1991 / 1343058 subtask_01_07.txt
test_08 2619 / 1343058 subtask_01_08.txt
test_09 4027 / 1343058 subtask_01_09.txt
test_10 3521 / 1343058 subtask_01_10.txt
Case Name Status Exec Time Memory
subtask_01_01.txt 119 ms 3468 KB
subtask_01_02.txt 113 ms 3532 KB
subtask_01_03.txt 120 ms 3604 KB
subtask_01_04.txt 117 ms 3516 KB
subtask_01_05.txt 119 ms 3592 KB
subtask_01_06.txt 119 ms 3484 KB
subtask_01_07.txt 116 ms 3576 KB
subtask_01_08.txt 117 ms 3484 KB
subtask_01_09.txt 119 ms 3512 KB
subtask_01_10.txt 116 ms 3580 KB