Submission #471727

#TimeUsernameProblemLanguageResultExecution timeMemory
471727rainboyAutomobil (COCI17_automobil)C11
100 / 100
18 ms8120 KiB
#include <stdio.h> #define N 1000000 #define M 1000000 #define MD 1000000007 int main() { static int aa[N], bb[M]; int n, m, k, i, j, a, b, c, d; scanf("%d%d%d", &n, &m, &k); for (i = 0; i < n; i++) aa[i] = 1; for (j = 0; j < m; j++) bb[j] = 1; while (k--) { static char s[2]; int x; scanf("%s", s); if (s[0] == 'R') { scanf("%d%d", &i, &x), i--; aa[i] = (long long) aa[i] * x % MD; } else { scanf("%d%d", &j, &x), j--; bb[j] = (long long) bb[j] * x % MD; } } /* (i m + j + 1) aa[i] bb[j] = (i aa[i] bb[j]) m + (j bb[j] aa[i]) + aa[i] bb[j] */ a = 0, c = 0; for (i = 0; i < n; i++) a = (a + aa[i]) % MD, c = (c + (long long) aa[i] * i) % MD; b = 0, d = 0; for (j = 0; j < m; j++) b = (b + bb[j]) % MD, d = (d + (long long) bb[j] * j) % MD; printf("%lld\n", ((long long) b * c % MD * m % MD + (long long) a * d % MD + (long long) a * b % MD) % MD); return 0; }

Compilation message (stderr)

automobil.c: In function 'main':
automobil.c:11:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf("%d%d%d", &n, &m, &k);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
automobil.c:20:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |   scanf("%s", s);
      |   ^~~~~~~~~~~~~~
automobil.c:22:4: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |    scanf("%d%d", &i, &x), i--;
      |    ^~~~~~~~~~~~~~~~~~~~~
automobil.c:25:4: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |    scanf("%d%d", &j, &x), j--;
      |    ^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...