Submission #100576

#TimeUsernameProblemLanguageResultExecution timeMemory
100576MohamedAhmed0Bob (COCI14_bob)C++14
12 / 120
313 ms9332 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n , m ; scanf("%d %d" , &n , &m) ; int arr[n][m] , last[n][m]; for(int i = 0 ; i < n ; ++i) { for(int j = 0 ; j < m ; ++j) scanf("%d" , &arr[i][j]) ; } for(int i = 0 ; i < n ; ++i) { last[i][m-1] = m-1 ; for(int j = m-2 ; j >= 0 ; --j) { if(arr[i][j] == arr[i][j+1]) last[i][j] = last[i][j+1] ; else last[i][j] = j ; } } long long ans = 0ll ; for(int i = 0 ; i < n ; ++i) { for(int j = 0 ; j < m ; ++j) { for(int k = i ; k < n ; ++k) { if(arr[i][j] != arr[k][j]) break; ans += min(last[i][j]-j+1ll , last[k][j]-j+1ll) * 1ll ; } } } return cout<<ans<<"\n" , 0 ; }

Compilation message (stderr)

bob.cpp: In function 'int main()':
bob.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d" , &n , &m) ;
     ~~~~~^~~~~~~~~~~~~~~~~~~
bob.cpp:13:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d" , &arr[i][j]) ;
             ~~~~~^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...