結果
問題 | No.2187 三立法和 mod 333 |
ユーザー |
|
提出日時 | 2023-03-15 22:57:36 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 44 ms / 100 ms |
コード長 | 1,328 bytes |
コンパイル時間 | 933 ms |
コンパイル使用メモリ | 89,824 KB |
最終ジャッジ日時 | 2025-02-11 11:42:53 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 33 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:25:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 25 | scanf("%d", &a); | ~~~~~^~~~~~~~~~
ソースコード
#include<stdio.h>#include<string.h>#include<stdlib.h>#include <map>#include <vector>#include <queue>#include <deque>#include <set>#include <stack>#include <algorithm>#include <array>#include <unordered_set>#include <unordered_map>#include <string>using namespace std;bool rcmp(int a, int b) { return a>b; }typedef long long LL;vector<LL> vs[333];int ks[128];int main() {int n, i, c=0, f1, f2,f3, j, a;scanf("%d", &a);LL v, vv, mv, r, dv, x;mv=4444; mv*=4444; mv*=4444; mv*=4444;for (i=1; i<4444; i++) {v=i; v*=i; v*=i;vv=v*i;v%=333;vs[v].push_back(vv);}for (i=0; i<333; i++) if (!vs[i].empty()) {// sort(vs[i].begin(), vs[i].end());ks[c++]=i;}r=0;for (i=0; i<c; i++) {f1=ks[i];for (j=0; j<c; j++) {f2=ks[j];f3=(a-f1-f2+666)%333;if (vs[f3].empty()) continue;for (auto v1 : vs[f1]) {x=vs[f3].size();for (auto v2: vs[f2]) {if (v1+v2>=mv) break;dv=mv-v1-v2;while(x&&vs[f3][x-1]>dv) x--;if (x==0) break;r+=x;}}}}printf("%lld\n", r);return 0;}