Submission #00039
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | #include<bits/stdc++.h> #include<cmath> #include<queue> #include<algorithm> using namespace std; using ll= long long ; using db= double ; typedef vector< int > vii; typedef vector<ll> vll; typedef vector<string> vstr; typedef vector< bool > vbl; int inf=(1LL<<31)-1; int MOD=1000000007; #define fi(a,b) for(int i=a;i<b;i++) #define fj(a,b) for(int j=a;j<b;j++) #define f_i(a,b) for(int i=a;i<=b;i++) #define f_j(a,b) for(int j=a;j<=b;j++) #define vvii(c,a,b) vector<vector<ii>> c(a,vector<ii>(b,0)) #define vvll(c,a,b) vector<vector<ll>> c(a,vector<ll>(b,0)) #define vvstr(c,a,b) vector<vector<string> c(a,vector<string>(b,0)) #define vvbol(c,a,b) vector<vector<bool>> c(a,vector<bool>(b,true)) #define bgen(c) c.begin(),c.end() const int yoko[3]={0,-1,0}; const int tate[3]={-1,0,1}; const int yoko_j[3]={0,1,0}; const int tate_j[3]={-1,0,1}; signed main() { ///////高速化/////// cin.tie(nullptr); ios_base::sync_with_stdio( false ); /////////////////// int n,m; cin >> n >> m; vvll (num,m,n); ll ans=0; fi(0,m) { fj(0,n) { cin >> num.at(i).at(j); } } cout << "#################" << endl; fi(0,m) { fj(0,n) { int k=0; if (num.at(i).at(j)) { for ( int o=0;o<3;o++) { if ((j+yoko[o]<0||j+yoko[o]>=n||i+tate[o]<0||i+tate[o]>=m)) { k+=2; continue ; } if (!num.at(i+tate[o]).at(j+yoko[o])) { k++; } } if (k==3||j==n-1||i==0||i==m-1) { for ( int o=0;o<3;o++) { if (j+yoko_j[o]<0||j+yoko_j[o]>=n||i+tate_j[o]<0||i+tate_j[o]>=m) { k++; continue ; } if (!num.at(i+tate_j[o]).at(j+yoko_j[o])) { k++; } } ans+=k; } else { ans+=k; } } else { for ( int o=0;o<3;o++) { if ((j+yoko[o]<0||j+yoko[o]>=n||i+tate[o]<0||i+tate[o]>=m)) { continue ; } if (num.at(i+tate[o]).at(j+yoko[o])) { k++; } } // if(k==3||j==n-1||i==0||i==m-1) // { // for(int o=0;o<3;o++) // { // if(j+yoko_j[o]<0||j+yoko_j[o]>=n||i+tate_j[o]<0||i+tate_j[o]>=m) // { // continue; // } // if(num.at(i+tate_j[o]).at(j+yoko_j[o])) // { // k++; // } // } // if(k!=6) // { // ans+=k; // } // } // else // { ans+=k; // } } cout << k << " " ; } cout << endl; } cout << ans << endl; return (0); } |
ステータス
項目 | データ |
---|---|
問題 | 0003 - イルミネーション (Illumination) |
ユーザー名 | <span style="color:#000000;font-weight:bold;">ei2031</span> |
投稿日時 | 2020-12-08 17:27:44 |
言語 | C++17 |
状態 | Wrong Answer |
得点 | 0 |
ソースコード長 | 3834 Byte |
最大実行時間 | 31 ms |
最大メモリ使用量 | 732 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | 入力1 | 0 / 20 | *1.txt |
2 | 入力2 | 0 / 20 | *2.txt |
3 | 入力3 | 0 / 20 | *3.txt |
4 | 入力4 | 0 / 20 | *4.txt |
5 | 入力5 | 0 / 20 | *5.txt |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # | ||||
---|---|---|---|---|---|---|---|---|
2012-yo-t5-in1.txt | WA | 23 ms | 604 KB |
1
|
||||
2012-yo-t5-in2.txt | WA | 20 ms | 684 KB |
2
|
||||
2012-yo-t5-in3.txt | WA | 31 ms | 732 KB |
3
|
||||
2012-yo-t5-in4.txt | WA | 21 ms | 592 KB |
4
|
||||
2012-yo-t5-in5.txt | WA | 24 ms | 588 KB |
5
|