Language: C++


コンテスト時間: 2018-08-25(土) 21:00 ~ 2018-08-25(土) 22:40 (100分)
AtCoderホームへ戻る

    トップ
    問題
    質問
    提出
    提出結果
    順位表
    バーチャル順位表
    コードテスト
    解説

コードテスト
言語
ソースコード

1

#include<bits/stdc++.h>

2

#define rep(i,n) for(int i=0; i<n; i++)

3

using namespace std;

4

using ll = long long;

5

const ll INF = 10e9;

6

ll MOD=1000000007;

7

​

8

int main(){

9

  int h,w; cin>>h>>w;

10

  char A[h][w];

11

  rep(i,h) rep(j,w) cin>>A[i][j];

12

  vector<bool>R(h,false), C(w,false);

13

  rep(i,h){

14

    rep(j,w){

15

      if (A[i][j]=='#') R[i]=true;

16

    }

17

  }

18

  rep(i,w){

19

    rep(j,h){

20

      if (A[j][i]=='#') C[i]=true;

21

    }

22

  }

23

​

24

  rep(i,h){

25

    if (R[i]){

26

      rep(j,w){

27

        if (C[j]) cout << A[i][j];

28

      }

29

      cout << endl;

30

    }

31

  }

32

}

※ 512 KiB まで
※ ソースコードは「Main.拡張子」で保存されます

標準入力
4 4
##.#
....
##.#
.#.#

※ 512 KiB まで
終了コード 	0
実行時間 	7 ms
メモリ 	416 KB
標準出力
###
###
.##
標準エラー出力
Facebook
Twitter
Hatena
共有

    ルール 用語集 

    利用規約 プライバシーポリシー 個人情報保護方針 企業情報 よくある質問 お問い合わせ 資料請求 

Copyright Since 2012 ©AtCoder Inc. All rights reserved.
ページトップ


Compiler output:
a.cc:2:22: error: invalid digit "8" in octal constant
    2 | コンテスト時間: 2018-08-25(土) 21:00 ~ 2018-08-25(土) 22:40 (100分)
      |                      ^~
a.cc:2:45: error: invalid digit "8" in octal constant
    2 | コンテスト時間: 2018-08-25(土) 21:00 ~ 2018-08-25(土) 22:40 (100分)
      |                                             ^~
a.cc:147:1: error: extended character ※ is not valid in an identifier
  147 | ※ 512 KiB まで
      | ^
a.cc:148:1: error: extended character ※ is not valid in an identifier
  148 | ※ ソースコードは「Main.拡張子」で保存されます
      | ^
a.cc:148:3: error: extended character 「 is not valid in an identifier
  148 | ※ ソースコードは「Main.拡張子」で保存されます
      |   ^
a.cc:148:24: error: extended character 」 is not valid in an identifier
  148 | ※ ソースコードは「Main.拡張子」で保存されます
      |                        ^
a.cc:152:1: error: stray '##' in program
  152 | ##.#
      | ^~
a.cc:152:4: error: stray '#' in program
  152 | ##.#
      |    ^
a.cc:154:1: error: stray '##' in program
  154 | ##.#
      | ^~
a.cc:154:4: error: stray '#' in program
  154 | ##.#
      |    ^
a.cc:155:2: error: stray '#' in program
  155 | .#.#
      |  ^
a.cc:155:4: error: stray '#' in program
  155 | .#.#
      |    ^
a.cc:157:1: error: extended character ※ is not valid in an identifier
  157 | ※ 512 KiB まで
      | ^
a.cc:162:1: error: stray '##' in program
  162 | ###
      | ^~
a.cc:162:3: error: stray '#' in program
  162 | ###
      |   ^
a.cc:163:1: error: stray '##' in program
  163 | ###
      | ^~
a.cc:163:3: error: stray '#' in program
  163 | ###
      |   ^
a.cc:164:2: error: stray '##' in program
  164 | .##
      |  ^~
a.cc:175:22: error: extended character © is not valid in an identifier
  175 | Copyright Since 2012 ©AtCoder Inc. All rights reserved.
      |                      ^
a.cc:2:1: error: '\U000030b3\U000030f3\U000030c6\U000030b9\U000030c8\U00006642\U00009593' does not name a type
    2 | コンテスト時間: 2018-08-25(土) 21:00 ~ 2018-08-25(土) 22:40 (100分)
      | ^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:21:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
  164 |   __is_null_pointer(std::nullptr_t)
      |                                   ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
  159 |     __is_null_pointer(_Type)
      |     ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
  164 |   __is_null_pointer(std::nullptr_t)
      |                          ^~~~~~~~~
In file included from /usr/include/c++/14/cstddef:50,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
  443 |   typedef decltype(nullptr) nullptr_t;
      |                             ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
                 from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
  666 |     struct is_null_pointer<std::nullptr_t>
      |                                 ^~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
  443 |   typedef decltype(nullptr) nullptr_t;
      |                             ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
  666 |     struct is_null_pointer<std::nullptr_t>
      |                                          ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
  670 |     struct is_null_pointer<const std::nullptr_t>
      |                                                ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
  674 |     struct is_null_pointer<volatile std::nullptr_t>
      |                                                   ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
  678 |     struct is_null_pointer<const volatile std::nullptr_t>
      |                                                         ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
 1429 |     : public integral_constant<std::size_t, alignof(_Tp)>
      |                                     ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
 1429 |     : public integral_constant<std::size_t, alignof(_Tp)>
      |                                                         ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
 1438 |     : public integral_constant<std::size_t, 0> { };
      |                                     ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
 1438 |     : public integral_constant<std::size_t, 0> { };
      |                                              ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
 1440 |   template<typename _Tp, std::size_t _Size>
      |                          ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
 1441 |     struct rank<_Tp[_Size]>
      |                     ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
 1441 |     struct rank<_Tp[_Size]>
      |                           ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
 1442 |     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
      |                                     ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
 1442 |     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
      |                                                                 ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
 1446 |     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
      |                                     ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
 1446 |     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
      |                                                                 ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared
 2086 |   template<typename _Tp, std::size_t _Size>
      |                          ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
 2087 |     struct remove_extent<_Tp[_Size]>
      |                              ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
 2087 |     struct remove_extent<_Tp[_Size]>
      |                                    ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
 2099 |   template<typename _Tp, std::size_t _Size>
      |                          ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
 2100 |     struct remove_all_extents<_Tp[_Size]>
      |                                   ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
 2100 |     struct remove_all_extents<_Tp[_Size]>
      |                                         ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
 2171 |   template<std::size_t _Len>
      |            ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
 2176 |         unsigned char __data[_Len];
      |                              ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
 2194 |   template<std::size_t _Len, std::size_t _Align =
      |            ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
 2194 |   template<std::size_t _Len, std::size_t _Align =
      |                              ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
 2195 |            __alignof__(typename __aligned_storage_msa<_Len>::__type)>
      |                                                       ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
 2195 |            __alignof__(typename __aligned_storage_msa<_Len>::__type)>
      |                                                           ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
 2202 |         unsigned char __data[_Len];
      |