Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
#include
#include
#include
#include
using namespace std; typedef long long ll; int main() { int k, n; cin >> k >> n; int a[n], b[n]; long long cnt_a[105], cnt_b[105]; for(int i = 0; i < 105; i++) { cnt_a[i] = 0; cnt_b[i] = 0; } for(int i = 0; i < n; i++) { cin >> a[i]; cnt_a[a[i]] += 1; } for(int j = 0; j < n; j++) { cin >> b[j]; cnt_b[b[j]] += 1; } long long answer = 0; for(int i = 0; i <= 100; i++) { for(int j = 0; j <= 100; j++) { if(i + j >= k and cnt_a[i] > 0 and cnt_b[j] > 0) { answer += cnt_a[i] * cnt_b[j]; } } } cout << answer << endl; return 0; } /* a[i] + b[j] >= k k - a[i] **/
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)