Submission #405697

# Submission time Handle Problem Language Result Execution time Memory
405697 2021-05-16T19:17:09 Z Aryan_Raina Plus Minus (BOI17_plusminus) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std; 
 
#define int int64_t
#define ld long double
#define ar array
 
const int INF = 1e17;
const int MOD = 1e9+7;
 
int32_t main() {
   ios_base::sync_with_stdio(0);
   cin.tie(0); cout.tie(0);
 
   int N, M, K; cin >> N >> M >> K;
   vector<ar<int,3>> A(K);
   for (auto &i : A) {
      char ch; cin >> ch >> i[1] >> i[2];
      i[0] = ch == '+';
   }

   map<int,vector<ar<int, 2>>> remdi;
   for (auto &[t, x, y] : A) remdi[x].push_back({y, t}); 
   int sol1 = N;
   for (auto [x, v] : remdi) {
      int sy = v[0][0], st = v[0][1];
      for (auto [y, t] : v) if ((abs(y - sy) & 1) != abs(t - st)) sol1 = -1;
      sol1--;
   }  

   remdi.clear(); int sol2 = M;
   for (auto &[t, x, y] : A) remdi[y].push_back({x, t});
   for (auto [y, v] : remdi) {
      int sx = v[0][0], st = v[0][1];
      for (auto [x, t] : v) if ((abs(x - sx) & 1) != abs(t - st)) sol2 = -1;
      sol2--;
   }

   auto pow = [&](int p) {
      if (p < 0) return 0LL;
      int res = 1, cur = 2;
      while (p) {
         if (p & 1) res = (res * cur) % MOD;
         cur = (cur * cur) % MOD; p >>= 1;
      }
      return res;
   };

   cout << pow(sol1) + pow(sol2) - (sol1 >= 0 && sol2 >= 0) - (K == 0);   
}  

Compilation message

plusminus.cpp: In lambda function:
plusminus.cpp:46:14: error: inconsistent types 'long long int' and 'long int' deduced for lambda return type
   46 |       return res;
      |              ^~~