Advertisement
TrickmanOff

Untitled

Aug 13th, 2019
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.58 KB | None | 0 0
  1. #pragma optimization_level 3
  2. #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
  3. #include <stdio.h>
  4. #include <iostream>
  5. #include <algorithm>
  6. #include <fstream>
  7. #include <vector>
  8. #include <queue>
  9. #include <functional>
  10. #include <set>
  11. #include <map>
  12. #include <math.h>
  13. #include <cmath>
  14. #include <string>
  15. #include <time.h>
  16. #include <random>
  17. #include <unordered_set>
  18. #include <unordered_map>
  19. #include <bitset>
  20. #include <string.h>
  21. using namespace std;
  22.  
  23. #define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
  24. #define cin in
  25. #define cout out
  26. #define pii pair<int,int>
  27. #define ll long long
  28. #define db double
  29. #define ld long double
  30. #define uset unordered_set
  31. #define umap unordered_map
  32. #define F first
  33. #define S second
  34. #define vec vector
  35. #define ms multiset
  36. #define pb push_back
  37. #define pll pair<ll,ll>
  38. #define pdd pair<ld, ld>
  39. #define pq priority_queue
  40. #define umap unordered_map
  41. #define uset unordered_set
  42. #define pii pair<int, int>
  43. #define pnn pair<Node*, Node*>
  44. #define uid uniform_int_distribution
  45.  
  46. ifstream in("input.txt");
  47. ofstream out("output.txt");
  48.  
  49. int n, m;
  50. //-1 : empty cell, 0 - normal ship, 1 - damaged ship
  51. vector<vector<int>> field;
  52. vector<vector<bool>> used;
  53.  
  54. void input() {
  55.     cin >> n >> m;
  56.     field.resize(n, vector<int>(m));
  57.  
  58.     for (int i = 0; i < n; i++) {
  59.         string s;
  60.         cin >> s;
  61.         for (int j = 0; j < m; j++) {
  62.             char cur = s[j];
  63.  
  64.             int& t = field[i][j];
  65.             if (cur == '-')
  66.                 t = -1;
  67.             else if (cur == 'S')
  68.                 t = 0;
  69.             else
  70.                 t = 1;
  71.         }
  72.     }
  73. }
  74.  
  75. int main()
  76. {
  77.     input();
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement